![](/img/trans.png)
[英]How do I fix a "Prefs file removed in background /home/steven/.java/.userPrefs/prefs.xml" error?
[英]How to change background of prefs activity?
我有一个prefs xml活动,其中有一个用于打开和关闭声音的复选框,以及一个供用户键入他/她的名字的编辑框。 有没有一种方法可以使prefs活动全屏显示并设置背景? 如果可能的话,我想设置自己的png背景。 谢谢。
使用主题并在<activity>
设置android:theme="@style/CustomTheme"
在您的styles.xml中创建带有以下各项的CustomTheme
<style name="CustomTheme">
<item name="android:windowBackground">@drawable/backgroundimage</item>
<item name="android:windowFullscreen">true</item>
</style>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/backgroundimage"
android:gravity="center_horizontal"
android:orientation="vertical" >
这里的“ backgroundimage”是来自您的资源的图像。
在oncreate()中-
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN)
我的pref.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
<EditTextPreference
android:title="Ime"
android:key="ime"
android:summary="Upišite svoje ime">
</EditTextPreference>
<CheckBoxPreference
android:title="Zvuk"
android:defaultValue="true"
android:key="checkbox"
android:summary="Ukljucite ili iskljucite zvukove u igri"/>
</PreferenceScreen>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.