我知道你可以在xml中設置自定義屬性及其值,但是, 可以稍後在運行時更改該值嗎?在Android中,可以在運行時更改自定義屬性的值嗎?
我有這樣的XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:example="http://schemas.android.com/apk/res/ValidatedButton.ValidatedButton"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<validatedbutton.ValidatedButton
android:id="@+id/myButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/icon_selector"
example:state_valid="false"
android:text="@string/hello" />
</LinearLayout>
我想改變例如:state_valid爲true或false在運行時。