开发者

android: Enable activity title when theme is set to NoTitleBar.Fullscreen

开发者 https://www.devze.com 2023-02-21 16:47 出处:网络
I have an app for which i have set the theme attribute to @android:style/Theme.Black.NoTitleBar.Fullscreen

I have an app for which i have set the theme attribute to

@android:style/Theme.Black.NoTitleBar.Fullscreen

this works ok as my application is running fullscreen without the window title bar now in one of my activities in need to enable the window title so i can use the

setTitle()

is there a way 开发者_运维问答to override the theme attribute in application. i have tried

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);

but that didn't help as the app now is not fullscreen and also does not have the window title


You can use another theme attribute for your activity, in your manifest, beside the theme you setted for your entire application, something like you can see for my activity NewsList:

<application android:icon="@drawable/icon" android:label="@string/app_name"
        android:screenOrientation="sensor" android:theme="@style/Theme.Black.NoTitleBar.Fullscreen" >
        <activity android:name=".Start" android:label="@string/app_name" >
        <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".news.NewsList" android:theme="@style/Theme.Black"></activity>          
        <activity android:label="Details" android:name=".news.NewsContent"></activity>      
        </application>
0

精彩评论

暂无评论...
验证码 换一张
取 消