Android Alternate row Colors in ListView

前端 未结 3 1710
旧巷少年郎
旧巷少年郎 2020-11-29 01:54
public class ListView extends  ListActivity {

static String item;

public void onCreate(Bundle icicle) {
            super.onCreate(icicle);

            ArrayAdapt         


        
3条回答
  •  长情又很酷
    2020-11-29 02:05

    The Background color for a custom listview row can be set with

    row.setBackgroundResource(R.color.list_bg_2)
    

    method in custom listview adapter in

    getView(int position, View convertView, ViewGroup parent)
    

    I have tried many things like row.setBackgroundColor(0xFF00DD) but couldn't get it done,

    here list_bg_2 is a color set res/values/color.xml

    
    
        #ffffff
        #fef2e8
    
    

提交回复
热议问题