Define list view with static elements on android in xml?

后端 未结 4 1986
傲寒
傲寒 2021-02-05 00:54

I want to create fragment which would display static menu as a set of rows in a list.

I like iOS method with static cells in a tableview. How can I achieve this in andro

4条回答
  •  Happy的楠姐
    2021-02-05 01:27

    Actually there is a way! Re-using Layouts with include - Tag

    Simply define a Layout you want to reuse.

    
     
     
     
    

    Then include it in your ViewGroup as many times as required

    
    
        
    
        
    
        ...
    
    
    

    You can also override all the layout parameters (any android:layout_* attributes) of the included layout's root view by specifying them in the tag. For example:

    
    

    More information at http://developer.android.com/training/improving-layouts/reusing-layouts.html

提交回复
热议问题