Question

Suppose I have an android app with android:theme="@android:style/Theme.NoTitleBar" applied to the application element in the manifest.

Is it possible, for a specific activity, to deviate from this application-wide theme and declaratively (i.e. through the manifest) get a title bar for that activity?

Thanks.

Was it helpful?

Solution 2

The non-declarative solution proposed by @arun-c-thomas put me on the right path:

Applying @android:style/Theme.DeviceDefault reverts the no-titlebar theme. It is not ideal in that it applies a full theme that would also revert other customizations that might have been in place, but in my case this is not an issue.

OTHER TIPS

Use setTheme(..) before calling setContentView(...)and super.oncreate() of your specific Activity

@Override
    protected void onCreate(Bundle savedInstanceState) {
        //set Theme here
        setTheme(android.R.style.Theme_DeviceDefault_Light);

        super.onCreate(savedInstanceState);      
        setContentView(R.layout.activity_main);

                .....
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top