Error: cannot find variable AppTheme_Dark_Dialog - android

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

Related

ActionBar Theme is ignored

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.

Appcompat 22.2 shows menu in capital case rather than lowercase

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>

How to change action bar background when using the Support Library?

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.

Eclipse error after moving project (No resource found that matches the given name)

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>

android 3.0+ action bar keep background when styling

I'm developing an App for Android 3.0+ and I want to personalize the action bar by removing the title, which I can accomplish, my problem is that I also lose the background on the action bar, I would just like to remove the title and keep the remaining style. Here's what I'm currently using:
<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. -->
<item name="android:actionBarStyle">#style/ActionBarNoTitle</item>
</style>
<style name="ActionBarNoTitle" parent="#android:style/Widget.Holo.ActionBar">
<item name="android:displayOptions">showHome|useLogo</item>
</style>
</resources>
I'd prefer not to change the Activity code to accomplish this.
Which theme are you using? That is probably defined in values-v11 or values-v14. If Theme.Holo.Light you have to change the actionBarStyle's parent style to Widget.Holo.Light.ActionBar.Solid.
<style name="ActionBarNoTitle" parent="#android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:displayOptions">showHome|useLogo</item>
</style>
Did you try this,
define this in your theme.xml file,
<style name="CustomActionBar" parent="android:style/Theme.Holo.Light">
<item name="android:actionBarStyle">#style/CustomActionBarStyle</item>
</style>
define this in your style.xml file,
<style name="CustomActionBarStyle" parent="android:style/Widget.Holo.ActionBar">
<item name="android:titleTextStyle">#style/NoTitleText</item>
<item name="android:subtitleTextStyle">#style/NoTitleText</item>
</style>
<style name="NoTitleText">
<item name="android:textSize">0sp</item>
<item name="android:textColor">#00000000</item>
</style>
Let me know if this works.

Categories

Resources