0
我有一個佈局,例如(我使用的片段):我該如何訪問drawable?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minWidth="25px"
android:minHeight="25px">
<TextView
android:id="@+id/Text_Value"
android:text="0"
android:textSize="32dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/PlaySquareShape"/>
</RelativeLayout>
我有這樣的形狀,在上述佈局中的背景的TextView的:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#4fa5d5"/>
</shape>
我需要改變可繪製的顏色。我如何從代碼訪問它?
我基本上有很多顯示片段的實例,我需要訪問特定片段的背景drawable。
完美!我會試試看。謝謝:)我仍然是新的。 – Maximus
它的工作!唯一的區別是我的背景是GradientDrawable :) – Maximus