How to specify id when uses include in layout xml file

前端 未结 11 2612
挽巷
挽巷 2020-12-02 08:55

In my layout xml file, I have included other layout xml file (each with a different android id).



        
11条回答
  •  无人及你
    2020-12-02 09:28

    When talking about include you either have an id on the root view inside the included layout file or on the include line itself and not on both. For example:

    
    

    Layout 1 file

    
    
    
    

    The above example is wrong because technically you have two id's declared for the same layout. So what you have to do is pick which element will have the id.

提交回复
热议问题