PreferenceActivity設置背景色(拖…

只需要在onCreate中加入設置CacheColor就可以了
@Override protected void onCreate(Bundle savedInstanceState) 
super.onCreate(savedInstanceState); mPrivacySettings = new PrivacySettings(this); addPreferencesFromResource(R.xml.privacysettings); this.getListView().setCacheColorHint(Color.parseColor("#00000000"));
this.getListView().setBackgroundColor(Color.rgb(76, 76, 76));
//。。。。
}

void android.widget.ListView.setCacheColorHint(int color)

public void setCacheColorHint (int color)

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

Parameters
color The background color 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章