Include layout with custom attributes

后端 未结 7 1003
我寻月下人不归
我寻月下人不归 2020-12-02 22:24

I\'m building a complex layout and I want to use include tag for my custom component, like this:



        
7条回答
  •  余生分开走
    2020-12-02 22:36

    It's not possible to attributes other than layout params, visibility or ID on an include tag. This includes custom attributes.

    You can verify this by looking at the source of the LayoutInflater.parseInclude method, around line 705: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/2.2_r1.1/android/view/LayoutInflater.java#640

    The inflater only applies the ID and visibility attributes to the included layout.

提交回复
热议问题