1.设置背景图片,图片来源于drawable;
flightInfoPanel.setBackgroundDrawable(getResources().getDrawable(R.drawable.search_label_click));
2.转换字符串为int(颜色),设置字体的颜色,不能用于设置背景;
listItemView.deleteFilghtBg.setBackgroundColor(Color.parseColor("#F5F5DC"));
本文介绍了如何在Android应用中设置UI元素的背景图片及颜色。通过使用`setBackgroundDrawable`方法可以设置视图的背景图片,而`setColorParse`方法则可用于将十六进制颜色字符串转换为颜色对象并设置文字颜色。
1.设置背景图片,图片来源于drawable;
flightInfoPanel.setBackgroundDrawable(getResources().getDrawable(R.drawable.search_label_click));
2.转换字符串为int(颜色),设置字体的颜色,不能用于设置背景;
listItemView.deleteFilghtBg.setBackgroundColor(Color.parseColor("#F5F5DC"));
1620

被折叠的 条评论
为什么被折叠?