Custom title bar - Does the system title bar appear briefly?

I have my own layout that I want to use as the title of my Android application. The found technique (linked below) works, but the system title bar is displayed before the onCreate () function is called. Obviously, this looks pretty sharp, as the system title bar is displayed on the screen, then my custom title bar is displayed:

// styles.xml
<resources>
  <style name="MyTheme">
    <item name="android:windowTitleSize">40dip</item>
  </style>
</resources>

// One of my activities, MyTheme is applied to it in the manifest.
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.my_activity);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.my_custom_header);
}

I could always hide the system’s title bar and show my own built-in, possibly every layout, but it’s not very friendly.

thank

http://www.londatiga.net/it/how-to-create-custom-window-title-in-android/

+2
source share
4 answers

, . , , , , . include , :

<include layout="@layout/title" />

requestWindowFeature (Window.FEATURE_NO_TITLE) , , , .

, , , , . :

<style name="FliqTheme" parent="@android:Theme.Black">
    <item name="android:windowNoTitle">true</item>
</style>

, , , ptc, / ( , ), , .

+3

, . android:theme android:style/Theme.NoTitleBar AndroidManifest.xml setTheme() , onCreate callback.

+1

Method with android setup: the theme does not work for me, I did this by adding the following code to the onCreate () subclass of the Activity:

  getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN);
0
source

All Articles