【发布时间】:2012-01-28 07:40:40
【问题描述】:
我想在自定义控件中使用 XML(不使用捆绑附加参数)在 Android 片段中定义自定义属性,例如 declare-styleable。但是没有带有 AttrSet 参数的构造函数,那么有可能吗?我可以覆盖public void onInflate(android.app.Activity activity, android.util.AttributeSet attrs, android.os.Bundle savedInstanceState) 以获得属性支持吗?
【问题讨论】:
-
编译时出错:
...\app\res\layout\select_category.xml:26: error: No resource identifier found for attribute 'showRadioButtons' in package 'com.companyX.projectY' ...\app\res\layout\select_category.xml:26: error: No resource identifier found for attribute 'highlightSelection' in package 'com.companyX.projectY' ...\app\res\layout\select_category.xml:26: error: No resource identifier found for attribute 'unselectedColor' in package 'com.companyX.projectY' -
app xml 命名空间和 declare-stylable 编写正确。如果需要,可以提供他们
标签: android android-fragments custom-attributes fragment