我如何能够完全改变我的preferenceActivity背景的颜色?请看我的截图。在平板电脑上,窗口背景和列表视图背景周围有一个白色边框。我想不出如何改变它的颜色/颜色。我只需要让它透明。
我就是这样完成截图的。此代码被放置在onCreate的PreferenceActivity中。
this.getListView().setBackgroundDrawable(this.getResources().getDrawable(R.drawable.splash_bg));
this.getWindow().setBackgroundDrawable(this.getResources().getDrawable(R.drawable.splash_bg));希望我不必进入任何样式,为了简单起见,我可以在代码中访问它。

发布于 2013-12-08 14:11:05
好的,您需要将布局设置为自定义布局。定制布局的唯一要求是有一个id为android的列表视图:id/ list
就像这样:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:background="@drawable/DRAWABLE HERE"
>
<ListView android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@android:id/list"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
/>
</LinearLayout>比你的onCreate of PrefActivity:
this.setContentView(R.layout.pref_act);https://stackoverflow.com/questions/20315412
复制相似问题