ViewStub を介してターゲット レイアウトのルート要素にカスタム属性を渡すことは可能ですか? そのようです:
<ViewStub
android:layout="@layout/custom_view"
app:customAttr="12345"
/>
custom_view.xml の場所:
<blah.CustomView ...>
...
</blah.CustomView>
私がそれをしようとすると、CustomView.java は AttributeSet で "app:customAttr" を取得しません。
ViewStub を使用せずに CustomView を直接使用する場合
<blah.Custom app:customAttr="12345"/>
属性は AttributeSet に正常に取得されます。
しかし、もう怠惰ではありません。
解決策はありますか?
ありがとう、ゆり。