ドローアブルフォルダにborder.xmlというxmlファイルがあります。このxmlには
<!-- +++++++++++++++++++++ BORDER +++++++++++++++++++ -->
<item>
<shape android:shape="rectangle">
<solid
android:id="@+id/shape_border_color"
android:color="@color/black" />
<gradient
android:id="@+id/shapre_border_gradient"
android:startColor="@color/BurlyWood"
android:endColor="@color/Blue"
android:angle="270"
/>
<!-- ++++++++++++++++++++ ROUND CORNERS ++++++++++++++++++++++++++++ -->
<corners
android:id="@+id/shape_border_corners"
android:bottomRightRadius="7dp"
android:bottomLeftRadius="7dp"
android:topLeftRadius="7dp"
android:topRightRadius="7dp"
/>
</shape>
</item>
<!-- +++++++++++++++++++++++ BACKGROUND ++++++++++++++++++++++++++ -->
<item
android:left="5dp"
android:right="5dp"
android:top="5dp" >
<shape android:shape="rectangle">
<gradient
android:id="@+id/shape_background"
android:id="@+id/hr_design_background_gradient"
android:startColor="@color/DarkOrchid"
android:endColor="@color/LawnGreen"
android:angle="270"/>
</shape>
</item>
次のコードを使用して、上記のxmlファイルをLinearLayout
main.xmlファイルの背景として使用します
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:padding="0dp"
android:background="@drawable/border_o2">
私のMain.javaアクティビティでは、境界線とコーナーstart and end colors
の境界線を変更することに興味があります。background
Radius
たとえば、TextViewを使用している場合、特定のIDの背景を変更する方法を知っています。しかし、Item / Shape/Gradiantの値を変更する方法がわかりません。
ありがとう