1

それを使用しているxmlから定義されたドローアブルリソースの属性を設定する方法はありますか? 次の例を検討してください。

描画可能な xml ファイルがあるとします。「orange_btn」という名前の形状は、次のように言います。

<?xml version="1.0" encoding="UTF-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/ripe_orange"/>

    <corners android:bottomRightRadius="16dp" android:bottomLeftRadius="16dp"
    android:topLeftRadius="16dp" android:topRightRadius="16dp"/>
</shape>

次のような画像ボタンを含むレイアウト xml があるとします。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:orientation="vertical">

<ImageView android:id="@+id/clouds"
    android:layout_width="32dp"
    android:layout_height="32dp"
    android:src="@drawable/orange"/>

</RelativeLayout>

レイアウト xml 内の角の半径など、形状の属性の 1 つを変更したい場合、どうすればよいでしょうか?

4

0 に答える 0