use*_*947 4 layout android themes styles preference
如何彻底改变我的偏好活动背景的颜色?请看我的截图.在平板电脑上,窗口背景和列表视图背景周围有一些白色边框.我无法弄清楚如何改变它的颜色/可绘制.我只需要让它变得透明.
这就是我实现截图的方式.此代码放在PreferenceActivity的onCreate中.
this.getListView().setBackgroundDrawable(this.getResources().getDrawable(R.drawable.splash_bg));
this.getWindow().setBackgroundDrawable(this.getResources().getDrawable(R.drawable.splash_bg));
Run Code Online (Sandbox Code Playgroud)
希望我不必进入任何样式,为了简单起见,我可以在代码中访问它.

好的,所以你需要将布局设置为自定义布局.自定义布局的唯一要求是具有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>
Run Code Online (Sandbox Code Playgroud)
比在你的创造力的创造:
this.setContentView(R.layout.pref_act);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3067 次 |
| 最近记录: |