以下のような XML で定義された形状オブジェクトがあります。
<shape android:shape="rectangle">
<gradient
android:startColor="#333"
android:centerColor="#DDD"
android:endColor="#333"/>
<stroke android:width="1dp" android:color="#FF333333" />
</shape>
コードで等しいオブジェクトを作成したいと考えています。GradientDrawable
以下のように作成しました。
gradientDrawable1.setColors(new int[] { 0x333, 0xDDD, 0x333 });
gradientDrawable1.setOrientation(Orientation.TOP_BOTTOM);
GradientDrawable
しかし、Stroke(?) を作成してから Stroke とtoの両方を割り当てる方法がわかりませんShape
何か案が?