Android - ListViews inside tableLayout

前端 未结 3 1844
攒了一身酷
攒了一身酷 2021-01-27 11:54

I\'m trying to build and app that shows organized data so I\'m thinking that basically a TableLayout would be a good idea, just to keep them in rows, so I\'m wonder

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-27 12:21

    so what i understand is that is not picking up the tablelayout. how can i fix this? is there another way to do this easly?

    Not quite, the renderer is taking account of the TableLayout but because the lint tool has detected that you have two views when you only need one (A LinearLayout and TableLayout) it is warning you that you should remove one of these layouts as it will boost performance while not effecting the functionality of the page.

    I will add, you have a TableLayout with just a single row. TableLayout's are designed to allow their contents to format their columns based upon all of their rows. With a single Row the TableLayout & Row together are acting as a LinearLayout:

    
        
            
            
    

    Since your TableLayout isn't adding any addition layout in that case it becomes obsolete and you will gain a resource boost from removing it and changing the orientation of LinearLayout to horizontal.

    If you're planning to add more TableRow's later, then you should instead remove the LinearLayout for the same reason - it will then become the view which is not adding extra information: your table layout will be entirely responsible for the layout so you might as well make it the parent of the layout file (remember to add xmlns:android="http://schemas.android.com/apk/res/android" attribute to it if you do.)

提交回复
热议问题