【发布时间】:2015-09-23 03:45:35
【问题描述】:
我正在寻找一种在 Android XML 的自定义属性中下拉可用值的方法,如下所示:
我做了什么:
attrs.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="font">
<attr name="fontType" format="string" />
<attr name="textSizeType" format="string" />
</declare-styleable>
</resources>
这样使用:
<com.MyTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
font:fontType="regular"
font:textSizeType="caption" />
稍后自定义属性的值将在 MyTextView 类中进行解释。
有什么方法可以下拉自定义属性的可用值?
【问题讨论】:
标签: android android-xml