How to specify id when uses include in layout xml file

前端 未结 11 2561
挽巷
挽巷 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:33

    Specify the ID in the

    
    

    Then use two findViewById to access fields in the layout

    View test1View = findViewById(R.id.test1);
    TextView test1TextView = (TextView) test1View.findViewById(R.id.text);
    

    Using that approach, you can access any field in any include you have.

提交回复
热议问题