Can't apply Theme from Android Action Bar Style Generator - android

I finished Android Action Bar Style Generator and downloaded the zip from there.
I copied and pasted all the folder in res, then changed the theme to let my app use the theme I edited. but The result is nothing changed!!!!
I am still beginner here. I am still not sure if there are other thing to deal with about changing Theme.
style_example.xml in folder values (created by the generator)
<style name="Theme.Example" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarItemBackground">#drawable/selectable_background_example</item>
<item name="popupMenuStyle">#style/PopupMenu.Example</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Example</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Example</item>
<item name="actionDropDownStyle">#style/DropDownNav.Example</item>
<item name="actionBarStyle">#style/ActionBar.Solid.Example</item>
<item name="actionModeBackground">#drawable/cab_background_top_example</item>
<item name="actionModeSplitBackground">#drawable/cab_background_bottom_example</item>
<item name="actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Example</item>
<!-- Light.DarkActionBar specific -->
<item name="actionBarWidgetTheme">#style/Theme.Example.Widget</item>
</style>
<style name="ActionBar.Solid.Example" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">#drawable/ab_solid_example</item>
<item name="backgroundStacked">#drawable/ab_stacked_solid_example</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_example</item>
<item name="progressBarStyle">#style/ProgressBar.Example</item>
</style>
<style name="ActionBar.Transparent.Example" parent="#style/Widget.AppCompat.ActionBar">
<item name="background">#drawable/ab_transparent_example</item>
<item name="progressBarStyle">#style/ProgressBar.Example</item>
</style>
<style name="PopupMenu.Example" parent="#style/Widget.AppCompat.PopupMenu">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_example</item>
</style>
<style name="DropDownListView.Example" parent="#style/Widget.AppCompat.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_example</item>
</style>
<style name="ActionBarTabStyle.Example" parent="#style/Widget.AppCompat.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_example</item>
</style>
<style name="DropDownNav.Example" parent="#style/Widget.AppCompat.Spinner.DropDown.ActionBar">
<item name="android:background">#drawable/spinner_background_ab_example</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_example</item>
<item name="android:dropDownSelector">#drawable/selectable_background_example</item>
</style>
<style name="ProgressBar.Example" parent="#style/Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_example</item>
</style>
<style name="ActionButton.CloseMode.Example" parent="#style/Widget.AppCompat.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_example</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Example.Widget" parent="#style/Theme.AppCompat">
<item name="popupMenuStyle">#style/PopupMenu.Example</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Example</item>
</style>
AndroidManifest.xml (I just forgot to change the name so it is "Theme.Example")
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mes.learnupdater1" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Example" > --------------------- Theme applied
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Main2Activity"
android:label="#string/title_activity_main2" >
</activity>
</application>
</manifest>

If you want customized your them you need to edit theme under the value folder style. XML file

Related

android:theme parameter inside manifest ignored

I have AppTheme style in my styles.xml file. In manifest file i choose it like application theme.
I want to login activity unique style and I created login style, and set it in manifest. But it is not working, LoginActivity still takes AppTheme.
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:name=".application.TrainerApp"
android:roundIcon="#mipmap/ic_launcher_round"
android:theme="#style/AppTheme"
android:supportsRtl="true">
<activity
android:name=".activities.login.LoginActivity"
android:theme="#style/LoginTheme"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
In style.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="LoginTheme" parent="#style/AppTheme">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="lollipop">true</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">#android:color/transparent</item>
</style>
Try like this :-
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="LoginTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#ff0</item>
<item name="colorPrimaryDark">#0ff</item>
<item name="colorAccent">#f0f</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="lollipop">true</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">#android:color/transparent</item>
</style>
Instead of :-
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="LoginTheme" parent="#style/AppTheme">
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowDrawsSystemBarBackgrounds" tools:targetApi="lollipop">true</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">#android:color/transparent</item>
</style>
Remove android:theme="#style/AppTheme" from your application tag and apply theme for each activity separately. For more detail, please see my link: http://androidkeeda.com/android-working-on-material-theme

Make toolbar and menu button have smaller height

I have a toolbar (please see xml below). Is there any easy way to make the tool bar thinner and keep the menu button.
Or maybe just have a menu button in some corner?
This started out as a full screen activity, but i roll up my own view and do a: setContentView(view);
thanks
<activity
android:name=".FullscreenActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name"
android:theme="#style/FullscreenTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<style name="FullscreenTheme" parent="AppTheme">
<item name="android:actionBarStyle">#style/FullscreenActionBarStyle</item>
<item name="android:windowActionBarOverlay">true</item>
<item name="android:windowBackground">#null</item>
<item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item>
<item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
</style>
<style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar">
<item name="android:background">#color/black_overlay</item>
</style>
</resources>
Specifying this styles:
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
...
<item name="actionBarSize">20dp</item>
<item name="actionBarStyle">#style/MyActionBarStyle</item>
</style>
<style name="MyActionBarStyle" parent="Widget.AppCompat.Light.ActionBar.Solid">
<item name="actionButtonStyle">#style/MyActionButtonStyle</item>
<item name="displayOptions">homeAsUp</item>
</style>
<style name="MyActionButtonStyle" parent="Widget.AppCompat.Light.ActionButton">
<item name="android:minWidth">20dp</item>
<item name="android:minHeight">20dp</item>
</style>
Will result in this output:

EditText not using theme

My EditText isn't using the theme I've assigned to it.
Here is my activity's property in AndroidManifest.xml:
<activity
android:name=".MainActivity"
android:label="Index"
android:screenOrientation="portrait"
android:theme="#style/IndexTheme"
android:windowSoftInputMode="stateVisible|adjustResize" >
</activity>
Here is my styles.xml:
<style name="IndexTheme" parent="AppBaseTheme">
<item name="android:windowContentOverlay">#null</item>
<item name="android:editTextStyle">#style/IndexEditText</item>
<item name="android:textCursorDrawable">#drawable/cursor_dark</item>
<item name="colorControlNormal">#color/text_c</item>
<item name="colorControlActivated">#color/primary</item>
<item name="colorControlHighlight">#color/primary</item>
</style>
<style name="IndexEditText" parent="#android:style/Widget.EditText">
<item name="android:textSize">16sp</item>
<item name="android:textColor">#color/white</item>
<item name="android:textColorHint">#color/white</item>
<item name="android:paddingTop">16dp</item>
<item name="android:paddingBottom">16dp</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
</style>
And here is my styles.xml (v21):
<style name="IndexTheme" parent="AppBaseTheme">
<item name="android:statusBarColor">#android:color/transparent</item>
<item name="android:editTextStyle">#style/IndexEditText</item>
<item name="alertDialogTheme">#style/AlertDialogTheme</item>
</style>
Yesterday it was working fine. Today I updated my support libraries from v22 to v23.1.1 and it not longer works.
Why?
use both these 2 lines instead
<item name="editTextStyle">#style/IndexEditText</item>
<item name="android:editTextStyle">#style/IndexEditText</item>
It's works for me.

Action bar style theme generator theme not getting applied

So I used the action bar style generator to create a theme with style compatibility mode set to AppCompat. I downloaded the ZIP file and copy and pasted all the files inside my folder but the theme isn't showing up when emulator is ran.
The styles_actionstyle.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Actionstyle" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarItemBackground">#drawable/selectable_background_actionstyle</item >
<item name="popupMenuStyle">#style/PopupMenu.Actionstyle</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Actionstyle</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Actionstyle</item>
<item name="actionDropDownStyle">#style/DropDownNav.Actionstyle</item>
<item name="actionBarStyle">#style/ActionBar.Solid.Actionstyle</item>
<item name="actionModeBackground">#drawable/cab_background_top_actionstyle</item>
<item name="actionModeSplitBackground">#drawable/cab_background_bottom_actionstyle</item>
<item name="actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Actionstyle</item>
<!-- Light.DarkActionBar specific -->
<item name="actionBarWidgetTheme">#style/Theme.Actionstyle.Widget</item>
</style>
<style name="ActionBar.Solid.Actionstyle" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">#drawable/ab_solid_actionstyle</item>
<item name="backgroundStacked">#drawable/ab_stacked_solid_actionstyle</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_actionstyle</item>
<item name="progressBarStyle">#style/ProgressBar.Actionstyle</item>
</style>
<style name="ActionBar.Transparent.Actionstyle" parent="#style/Widget.AppCompat.ActionBar">
<item name="background">#drawable/ab_transparent_actionstyle</item>
<item name="progressBarStyle">#style/ProgressBar.Actionstyle</item>
</style>
<style name="PopupMenu.Actionstyle" parent="#style/Widget.AppCompat.PopupMenu">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_actionstyle</item>
</style>
<style name="DropDownListView.Actionstyle" parent="#style/Widget.AppCompat.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_actionstyle</item>
</style>
<style name="ActionBarTabStyle.Actionstyle" parent="#style/Widget.AppCompat.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_actionstyle</item>
</style>
<style name="DropDownNav.Actionstyle" parent="#style/Widget.AppCompat.Spinner.DropDown.ActionBar">
<item name="android:background">#drawable/spinner_background_ab_actionstyle</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_actionstyle</item>
<item name="android:dropDownSelector">#drawable/selectable_background_actionstyle</item>
</style>
<style name="ProgressBar.Actionstyle" parent="#style/Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_actionstyle</item>
</style>
<style name="ActionButton.CloseMode.Actionstyle" parent="#style/Widget.AppCompat.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_actionstyle</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Actionstyle.Widget" parent="#style/Theme.AppCompat">
<item name="popupMenuStyle">#style/PopupMenu.Actionstyle</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Actionstyle</item>
</style>
</resources>
The V14 version:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Actionstyle" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarItemBackground">#drawable/selectable_background_actionstyle</item>
<item name="android:popupMenuStyle">#style/PopupMenu.Actionstyle</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.Actionstyle</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle.Actionstyle</item>
<item name="android:actionDropDownStyle">#style/DropDownNav.Actionstyle</item>
<item name="android:actionBarStyle">#style/ActionBar.Solid.Actionstyle</item>
<item name="android:actionModeBackground">#drawable/cab_background_top_actionstyle</item>
<item name="android:actionModeSplitBackground">#drawable/cab_background_bottom_actionstyle</item>
<item name="android:actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Actionstyle</item>
<!-- Light.DarkActionBar specific -->
<item name="android:actionBarWidgetTheme">#style/Theme.Actionstyle.Widget</item>
</style>
<style name="ActionBar.Solid.Actionstyle" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#drawable/ab_background_textured_actionstyle</item>
<item name="android:backgroundStacked">#drawable/ab_stacked_solid_actionstyle</item>
<item name="android:backgroundSplit">#drawable/ab_background_textured_actionstyle</item>
<item name="android:progressBarStyle">#style/ProgressBar.Actionstyle</item>
</style>
<style name="ActionBar.Transparent.Actionstyle" parent="#style/Widget.AppCompat.ActionBar">
<item name="android:background">#drawable/ab_transparent_actionstyle</item>
<item name="android:progressBarStyle">#style/ProgressBar.Actionstyle</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Actionstyle.Widget" parent="#style/Theme.AppCompat">
<item name="android:popupMenuStyle">#style/PopupMenu.Actionstyle</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.Actionstyle</item>
</style>
</resources>
The manifests file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.blooddonation2" >
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Actionstyle" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

ActionBar Custom Title Color

<?xml version="1.0" encoding="utf-8"?>
<style name="OmlActionBarTheme" parent="#android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/OmlActionBar</item>
<item name="android:homeAsUpIndicator">#drawable/back_arrow</item>
<item name="android:titleTextStyle">#style/OmlActionBarTitle</item>
<item name="android:subtitleTextStyle">#style/OmlActionBarSubTitle</item>
</style>
<style name="OmlActionBar" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/action_bar_white</item>
</style>
<style name="OmlActionBarTitle" parent="#android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#color/action_bar_blue</item>
</style>
<style name="OmlActionBarSubTitle" parent="#android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle">
<item name="android:textColor">#color/action_bar_blue</item>
</style>
Hi,I need to customize my actionBar title Text Color and subTitle Text Color. I used the above style but there is no change.
Try The Following...
style.xml
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
<item name="android:windowBackground">#drawable/login_background</item>
<item name="android:actionBarStyle">#style/MyActionBar</item>
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar"
parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/theme_blue</item>
<item name="titleTextStyle">#style/ActionBarTitleText</item>
<item name="subtitleTextStyle">#style/ActionBarSubTitleText</item>
</style>
<style name="ActionBarTitleText" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textColor">#color/stdDarkBlueText</item>
<item name="android:textSize">12sp</item>
</style>
<style name="ActionBarSubTitleText" parent="#style/TextAppearance.AppCompat.Widget.ActionBar.Subtitle">
<item name="android:textColor">#color/stdDarkBlueText</item>
<item name="android:textSize">12sp</item>
</style>
</resources>
Apply this theme to your application in Manifest File..
AndroidManifest.xml
<application
android:allowBackup="true"
android:icon="#drawable/ic_icon128"
android:label="#string/app_name"
android:theme="#style/AppTheme" // apply theme here
android:windowSoftInputMode="stateHidden" >
i have done with simple one line code
actionBar.setTitle(Html.fromHtml("<font color='#ff0000'>ActionBartitle </font>"));

Categories

Resources