I am using the following style to change the menu to lower case but it does not work.
I've searched on the internet for references but I couldn't find anything.I think there is problem with the library.If anyone has an answer please tell me.
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="actionMenuTextAppearance">#style/MyMenuTextAppearance</item>
<item name="android:actionMenuTextAppearance">#style/MyMenuTextAppearance</item>
</style>
<style name="MyMenuTextAppearance" parent="TextAppearance.AppCompat.Widget.ActionBar.Menu">
<item name="android:textAllCaps">false</item>
</style>
Related
I'm trying to create a login activity in android studio and I keep getting this error:
error: cannot find symbol variable AppTheme_Dark_Dialog
How do I resolve this error?
This is my styles.xml file :
<!-- 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="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppBaseTheme" parent="android:Theme.Holo.Dialog" />
Go into the layout editor, select where it most likely says App theme and look for another one. There are a lot of themes even on dark. Further, it is just Holo.Dialog unless you want the light theme which is Holo.Light.Dialog. Holo.Dark.Dialog is the same as Holo.Dialog as far as I can tell.
To set it, find the style xml files and set:
<style name="AppBaseTheme" parent="android:Theme.Holo.Dialog">
In the normal style.xml that is not defined with v11 and v14, just blank in Android studio.
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Dialog">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Dialog">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
</resources>
You may want to look into AppCompat as well, as it allows the use of e.g. material design before API 21. And it saves time compared to manually writing layouts for the different versions
This is strange.
I'm trying to change color of ActionBar using themes.
Here's my code for styles.xml in values:
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
<item name="android:actionBarStyle">#style/TheActionBarTheme</item>
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="TheActionBarTheme" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#1f1f2f</item>
</style>
</resources>
And for styles.xml in values-14:
<resources>
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 14 theme customizations can go here. -->
<item name="android:actionBarStyle">#style/TheActionBarTheme</item>
</style>
<style name="TheActionBarTheme" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#1f1f2f</item>
</style>
</resources>
I use requestWindowFeature(Window.FEATURE_ACTION_BAR); in MainActivity
But the color of ActionBar doesn't change - it is standart. Where did I screw up?
I got your problem , I am sharing a xml style code to you check that.
<style name="AppTheme1" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#693EB4</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
In this code sample I have made a new style for action bar in style.xml, in this colorPrimary is small top bar(StatusBar) color and colorPrimary dark is the color of ActionBar, so you need to change this color.
And the parent value is the type of action bar theme you want.
I tried example code (https://developer.android.com/training/basics/actionbar/styling.html) on 'Customize the Background'.
but I want to know how this works. -> '#drawable/actionbar_background'
It seems to add 'actionbar_background.png' file to somewhere res folder but I don't know where.
So I changed source like this.
<!-- Action Bar styles -->
<style
name="MyActionBar"
parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#FF6600</item>
<!-- Support library compatibility -->
<item name="background">#FF6600</item>
</style>
but this part
<item name="background">#FF6600</item>
doesn't work.
I don't know what type is appropriate.
Please Use this in style.xml in res>>Values
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#4cb9f6</item>
</style>
In my case I also couldn't change the background using the XML style file, so I just changed the color inside the "onCreate" of my activity.
getActionBar().setBackgroundDrawable(new ColorDrawable(Color.parseColor(MY_COLOR)));
Maybe this isn't the best practice, but it is functional.
I had a perfectly working project of an app on android. It uses actionbarsherlock. I moved using the refactor menu in eclipse to another folder and now I have problems with the styles.xml
No resource found that matches the given name 'windowActionBarOverlay'
As I said, the project worked well before moving it so I think it has something to do with the build path.
Restoring it to the previous folder doesn't fix the problem.
Thanks a lot!
Styles.xml
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="AppTheme">
<item name="windowActionBarOverlay">true</item>
</style>
<style name="PagerTabStripText">
<item name="android:textSize">15dp</item>
</style>
<style name="btnStyleBeige" parent="#android:style/Widget.Button">
<item name="android:textSize">12sp</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">#000000</item>
<item name="android:gravity">center</item>
<item name="android:background">#drawable/btn_beige</item>
<item name="android:padding">5dp</item>
</style>
</resources>
I want to change the color of the text of menu items in the action bar. I' tried to change the theme but nothing works. I'm ussing API 19:
This is my res\values\styles.xml
<resources>
<!--
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
-->
</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="LoginFormContainer">
<item name="android:padding">28dp</item>
</style>
</resources>
Also the project generated styles.xml in res\values-v11\ res\values-v14\
I don't know if I have to change the theme or just set a property or something, any help I will really appreciate. Thank you!
Finally I found a solution to my problem. This is my final code:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Base application theme for API 14+. This theme completely replaces
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<!-- API 14 theme customizations can go here. -->
<item name="android:textAppearanceLargePopupMenu" >#style/m_textAppearanceLargePopupMenu</item>
<item name="android:textAppearanceSmallPopupMenu" >#style/m_textAppearanceSmallPopupMenu</item>
</style>
<style name="m_textAppearanceLargePopupMenu" parent="#android:style/TextAppearance.Holo.Widget.PopupMenu.Large">
<item name="android:textColor">#009ad2</item>
</style>
<style name="m_textAppearanceSmallPopupMenu" parent="#android:style/TextAppearance.Holo.Widget.PopupMenu.Small">
<item name="android:textColor">#009ad2</item>
</style>
</resources>
It is my res\values-v14\ file code.
I was confused, what I really wanted was to change the text color to the PopupMenu and it worked for me.
Thanks friends for your help!!
Check this Documentation in the section Customize the Text Color. It says the way you have to do it for the different android API levels.