Remove Titlebar In Xml
Im trying to remove the titlebar at the top of my app. I know this can be done by adding, @android:style/Theme.NoTitleBar to the manifest. The thing is that this makes the Holo the
Solution 1:
You can specify different default themes for different API levels.
In Android you have the directories values-v11
and values
. The first one is for all Android 3.0 and above (if no other one with higher version is specified). The second is the default one.
In the styles.xml
of values-v11
you define:
<stylename="AppBaseTheme"parent="android:Theme.Holo.NoActionBar"></style>
and in the styles.xml
of values
:
<stylename="AppBaseTheme"parent="android:Theme.NoTitleBar"></style>
If you put android:theme="@style/AppBaseTheme"
in the <application>
tag of the manifest you should keep the Holo theme on 3.0+ devices.
Solution 2:
You can try this:-
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
...
}
Solution 3:
use bellow method before write setContentView()
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
}
Solution 4:
Use below code in onCreate()
if(android.os.Build.VERSION.SDK_INT>11)
setTheme(android.R.style.Theme.Holo.NoActionBar);
else
setTheme(android.R.style.Theme_DeviceDefault_NoActionBar);
Post a Comment for "Remove Titlebar In Xml"