Initially in the manifest when i don't set any theme inside the activity tag my option menu look like this which is default..
But once i set this theme android:theme="#android:style/Theme.NoTitleBar" in the activity tag of my manifest file the option menu style changes.
Screen shots after adding android:theme="#android:style/Theme.Holo.NoActionBar.Fullscreen"
Why this happen.
Try this.
<activity
android:theme="#android:style/Theme.Holo.NoActionBar.Fullscreen" >
Look Here For Android Holo themes with backwards compatibility
Edit Try android:showAsAction="ifRoom" in menu.xml file. Look at this for More
Related
I am new to Android and I'm facing this problem.
I got MainActivity with items list, when one of them is clicked then the DetailActivity starts.
I disabled ActionBar with
<style name="AppTheme" parent="android:Theme.Material.Light.NoActionBar">
so the MainActivity no longer have actionBar. But I want this ActionBar in the DetailActivity ( i need the basic one, with the left arrow to get back to MainActivity ), so I created another style
<style name="DetailTheme" parent="android:Theme.Material.Light.DarkActionBar">
and used it in activity_detail.xml like this
android:theme="#style/DetailTheme"
But it seems this is not the right way, because there is no ActionBar in that Activity .
I'm currently not sure if DetailActivity will be the only one with ActionBar, so I would like to know how to activate it on just this one Activity.
What is the right solution for this ?
Not sure but maybe try assigning it to the activity in the manifest
<activity android:name=".DetailActivity"
android:theme="#style/DetailTheme"/>
used it in activity_detail.xml like this android:theme="#style/DetailTheme"
My best guess is that you mean you added the android:theme attribute to the root view tag in your layout file. Maybe something like this:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:theme="#style/DetailTheme"
...
/>
This doesn't actually apply the theme to your Activity, it only applies the theme to your Activity's "content view". Content views don't have action bars, so those attributes of the theme will be ignored.
To apply a theme to an Activity, you have to specify it in AndroidManifest.xml
<activity
android:name=".DetailActivity"
android:theme="#style/DetailTheme"/>
Can someone explain what is happening here. I load a blank Activity and two xml files are created in Android Studio; the content_main.xml, which contains all of my widgets, and activity_main.xml, which includes my contents file and looks like this:
I don't want to use this Toolbar so I delete it. Now the activity_main.xml file looks like this:
I still want to have an actionBar however. My manifest file, clearly references a theme in my styles folder:
And here is is the styles.xml file, which sets a theme for the Action Bar:
How come, when I start the emulator, my action bar is missing? My main_activity extends AppCompatActivity. Any idea why this is happening?
you are activity is overriding the Application's theme and using the NoActionBar theme. Get rid of android:theme from the <activity tag
Change from
<activity
android:theme="#style/AppTheme.NoActionBar"
android:name=".MainActivity"
android:label="#string/app_name">
to
<activity
android:name=".MainActivity"
android:label="#string/app_name">
I need a dialog activity. So i defined the activity in my Manifest file with:
android:theme="#android:style/Theme.Dialog"
but this theme has old Gingerbread look with dark background and so on. I want to complete holo theme on my dialog activity... Is there a theme like Theme.Dialog.Holo.Light ?
Use under activity tag:
<activity
android:theme="#android:style/Theme.Holo.Light.Dialog" >
</activity>
I am testing my app but when I choose settings my preferences screen shows White instead of the default black theme. Just with my app because any other app shows the right black theme in preference screen.
<style name="PreferencesTheme">
<item name="android:background">#000000</item>
</style>
add the above code in value -> styles and
then add
<activity android:name=".Preferrence" android:theme="#android:style/Theme.Black"></activity>
in your manifest file it will solve your problem :)
I guess you using the Light Theme in your AndroidManifest.xml. For those PreferenceActivity set the Theme like this:
<activity
android:name="PreferenceActivity"
android:theme="#android:style/Theme.Holo" >
</activity>
I am using following code to replace title bar.
final boolean customTitleSupported = requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
And it's working fine once UI loaded. Problem is however when I start the app, the ugly gray bar appears for 1-2 seconds until UI loaded. Is there any way to specify not showing the default title bar at all?
If you want the titlebar to be gone in every activity within your app, then add
<application android:name=".YourAppNameHere"
android:label="#string/app_name"
android:icon="#drawable/icon"
android:theme="#android:style/Theme.NoTitleBar">
to your manifest. Not 100% sure though that this will prevent the titlebar from showing up momentarily, but it should work.
In the Manifest file, add this line inside the application tag
android:theme="#android:style/Theme.NoTitleBar"
It will hide the bar from all the activities. If you want to hide it from a specific activity, add the same line to that activity's tag.
Good Luck !
You should add a line to your AndroidManifest which states that you use a theme (standard android or extended)
<application android:name=".YourAppNameHere"
android:label="#string/app_name"
android:icon="#drawable/icon"
android:theme="#style/MyTheme">
and then you can have a themes.xml in your res/values/ folder where you extend the: Theme.NoTitleBar and add custom rules to them (for example like windowBackground)
<resources>
<style name="MyTheme" parent="android:Theme.NoTitleBar">
<item name="android:windowBackground">#drawable/my_background</item>
</style>
<resources>
Have fun