Changing a divider with setDivider in a ListActivity without a custom ListView?

前端 未结 3 1604
无人共我
无人共我 2021-02-01 07:53

I can\'t seem to get a customized divider, using a Drawable I\'ve defined, to work when using a ListActivity and not creating a custom ListView. It al

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-01 08:53

    Try this code:

    searchText.setBackgroundColor(getResources().getColor(R.color.wordColorBlack));
    ListView lv = getListView();
    lv.setDivider(getResources().getDrawable(R.drawable.divider2));
    lv.setDividerHeight(2);
    

提交回复
热议问题