PreferenceActivity设置背景色(拖…

来源:互联网 发布:centos 6 sz 编辑:程序博客网 时间:2024/06/03 21:44
只需要在onCreate中加入设置CacheColor就可以了
@Override protected void onCreate(BundlesavedInstanceState) 
super.onCreate(savedInstanceState); mPrivacySettings = newPrivacySettings(this);addPreferencesFromResource(R.xml.privacysettings); this.getListView().setCacheColorHint(Color.parseColor("#00000000"));
this.getListView().setBackgroundColor(Color.rgb(76,76, 76));
//。。。。
}

Open Declarationvoid android.widget.ListView.setCacheColorHint(intcolor)

publicvoid setCacheColorHint(int color)

Since: APILevel 1

When set to a non-zero value, the cache color hint indicatesthat this list is always drawn on top of a solid, single-color,opaque background. Zero means that what's behind this object istranslucent (non solid) or is not madeof a single color. This hint will not affect any existingbackground drawable set on this view ( typically set viasetBackgroundDrawable(Drawable)).

Parameters
colorThe background color 
0 0
原创粉丝点击