setBackgroundDrawable for ListView in Android

后端 未结 5 903
长发绾君心
长发绾君心 2020-12-14 21:06

How do I set a drawable as the background for a list view in a class?

if (array1.size() < 8)
{
    lv1.setBackgroundDrawable(R.drawable.bgimghs2b);
}
         


        
5条回答
  •  甜味超标
    2020-12-14 21:18

    Use this: android.view.View.setBackgroundResource(int resID)

    lv1.setBackgroundResource(R.drawable.bgimghs2b);
    

提交回复
热议问题