3
是否可以通过ViewStub将自定义属性传递到目标布局的根元素?像这样:ViewStub具有目标布局的自定义查看属性
<ViewStub
android:layout="@layout/custom_view"
app:customAttr="12345"
/>
其中custom_view.xml是:AttributeSet中的:
<blah.CustomView ...>
...
</blah.CustomView>
当我尝试这样做,CustomView.java没有得到 “customAttr应用”。
当我直接使用CustomView,没有ViewStub
<blah.Custom app:customAttr="12345"/>
属性进入AttributeSet中的确定。
但它不再懒惰。
任何解决方案?
谢谢, Yuri。