我知道你可以在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在运行时。