Frage

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.

War es hilfreich?

Lösung 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.

Andere Tipps

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);

                .....
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top