What is difference between android.R.layout.simple_list_item_1 and android.R.layout.simple_list_item_2

后端 未结 6 1930
南旧
南旧 2020-12-08 15:00

Can anyone explain android.R.layout.simple_list_item_1 and android.R.layout.simple_list_item_2 in arrayadapter in android.

I know in android.R.layout.simple_list_ite

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 15:35

    The difference is the following. simple_list_item_1 contains only a TextView, whereas simple_list_item_2 has two inside a subclass of RelativeLayout. These are both taken from Jelly Bean.

    simple_list_item_1

    
    
    
    
    

    simple_list_item_2

    
    
    
    
    
        
    
        
    
    
    

    According to the docs for ArrayAdapter:

    By default this class expects that the provided resource id references a single TextView.

    So by default, an ArrayAdapter doesn't automatically fill in multiple TextView instances. You can, however, override the getView() method and fill in the two TextViews that appear in R.layout.simple_list_item_2

提交回复
热议问题