Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 覆盖活动';由主题设置的背景_Android_Android Activity_Android Alertdialog_Android Theme_Android Styles - Fatal编程技术网

Android 覆盖活动';由主题设置的背景

Android 覆盖活动';由主题设置的背景,android,android-activity,android-alertdialog,android-theme,android-styles,Android,Android Activity,Android Alertdialog,Android Theme,Android Styles,我目前有一个启动屏幕的活动。以下是我将主题应用于活动的方式: <application ... <activity android:name=".activities.SplashActivity" android:configChanges="orientation|keyboardHidden" android:screenOrientation="portrait" android:theme="

我目前有一个启动屏幕的活动。以下是我将主题应用于活动的方式:

<application
    ...

    <activity
        android:name=".activities.SplashActivity"
        android:configChanges="orientation|keyboardHidden"
        android:screenOrientation="portrait"
        android:theme="@style/SplashTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

一旦应用活动主题,就不可能更改它

是否有一种方法可以覆盖主题定义的
android:background
,用于
警报对话框

AlertDialog
有一个构造函数,它接受
themeResId
作为输入。发件人:

创建使用显式主题资源的警报对话框

创建自定义主题,覆盖
android:background
属性,然后使用新创建的主题创建
AlertDialog

Dialog dialog = new AlertDialog(context, R.style.my_dialog_theme);

一旦应用活动主题,就不可能对其进行更改

是否有一种方法可以覆盖主题定义的
android:background
,用于
警报对话框

AlertDialog
有一个构造函数,它接受
themeResId
作为输入。发件人:

创建使用显式主题资源的警报对话框

创建自定义主题,覆盖
android:background
属性,然后使用新创建的主题创建
AlertDialog

Dialog dialog = new AlertDialog(context, R.style.my_dialog_theme);
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:windowBackground">@drawable/splash_background</item>
</style>
Dialog dialog = new AlertDialog(context, R.style.my_dialog_theme);