【发布时间】:2014-10-28 19:22:03
【问题描述】:
我知道可以在 xml 中设置自定义属性及其值,但是, 以后可以在运行时更改该值吗?
我有这个 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>
我想在运行时将 example:state_valid 更改为 true 或 false。
【问题讨论】:
标签: runtime android-custom-attributes