From manifest: min version 14
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
Style:
<style name="AppBaseTheme" parent="#android:style/Theme.Holo.Light.DarkActionBar">
<!--
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="android:windowBackground">#color/fondoObscuro</item>
<item name="android:actionBarStyle">#style/OnTheGoActionBar</item>
</style>
<!-- general styles for the action bar -->
<style name="OnTheGoActionBar"
parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:titleTextStyle">#style/TitleTextStyle</item>
<item name="android:background">#color/actionBarObscura</item>
<item name="android:actionOverflowButtonStyle">#style/CustomOverflow</item>
</style>
I got the error no resource found, on both styles AppBaseTheme and OnTheGoActionBar
There is very specific reason for having two seperate values folder especially for `theming the app
See as you can see in the code you posted, I am sure that following code is from values\styles.xml
<style name="AppBaseTheme" parent="#android:style/Theme.Holo.Light.DarkActionBar">
<!--
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>
I would like to draw your attention to commented code
Theme customizations available in newer API levels can go in res/values-vXX/styles.xml
The styles.xml is for backward compatibility, you change the parent style
parent="android:Theme.Light" to parent="android:Theme.Holo.Light.DarkActionBar"
which is wrong since android:Theme.Holo.Light.DarkActionBar was introduced in API Level-14, See here Theme_Holo_Light_DarkActionBar Android docs. The Builder looks for Theme.Holo.Light.DarkActionBar , but it is not able to find it, as its applicable to new version and hence you see
I got the error no resource found, on both styles AppBaseTheme and OnTheGoActionBar
Simple move your code for custom styling to values-v14\styles.xml and everything will be fine, don't worry if you don't have style provided in values\styles.xml, untill and unless your minSdkVersion is 14.
I hope you understood it.
Related
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>
I'm quite new to android. I created an application for api7 to api19 using support library and Theme.AppCompat.Light theme and I'm trying now to apply a custom theme to it but I get the error android:editTextBackground requires API level 11 (current min is 7) on the second line of themes_wvtheme.xml. I would like to know the correct edittext attribute for api<11.
This is my style.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="#style/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>
This is my custom theme themes_wvtheme.xml:
<?xml version="1.0" encoding="utf-8"?>
<item name="android:editTextBackground">#drawable/wvtheme_edit_text_holo_light</item>
<item name="android:listChoiceIndicatorMultiple">#drawable/wvtheme_btn_check_holo_light</item>
<item name="android:listChoiceIndicatorSingle">#drawable/wvtheme_btn_radio_holo_light</item>
<item name="android:buttonStyle">#style/ButtonWVTheme</item>
<item name="android:imageButtonStyle">#style/ImageButtonWVTheme</item>
<item name="android:listChoiceBackgroundIndicator">#drawable/wvtheme_list_selector_holo_light</item>
<item name="android:activatedBackgroundIndicator">#drawable/wvtheme_activated_background_holo_light</item>
You can create a style for your EditTexts, and specify a background attribute for it. That is, in style.xml put something like:
<style name="Theme.MyApp.EditText" parent="#android:style/Widget.EditText">
<item name="android:background">#drawable/wvtheme_edit_text_holo_light</item>
<!-- ..other attributes.. -->
</style>
Then, in your app theme, add the line:
<item name="android:editTextStyle">#style/Theme.MyApp.EditText</item>
The oldest API level I've built for using this approach is 8, but it should work for API level 7 as well.
i have app which was created in android:Theme.Light. i want to change it to Theme.AppCompat.Light.DarkActionBar but i get
no resource found that matches the given name
'theme.appcompat.light.darkactionbar'
I have android-support-v4.jar, when i try add appcompat_v7 i get errors in codes where is something like it R..... Can I add DarkActionBar to this project without problems with codes? Without changes in code?
I have:
<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>
</resources>
I want:
<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="Theme.AppCompat.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>
</resources>
Ensure that your application is properly linked with the Support Library, with resources (see documentation here).
And don't forget #style/:
<style name="AppTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
This will prevent the no resource error from occurring.
You might be interested in this tutorial too.
If you're doing this in your manifest, do the following to set the theme for the whole app:
<application
...
android:theme="#style/Theme.AppCompat.Light.DarkActionBar"
...>
in your XML for the specific theme, you need #style, so put the following:
<style name="AppTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
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.
MinSDKVersion = 7
TargetSDKVersion = 17
If the user have SDKVersion 11 or higher I like to set the theme to Theme.Holo.Light.
It doesn't works for me here. When I launch the app on a 3.1 device it just uses the Theme.Light:
Same when I run this app on a device with lower version than 3.1
My Folderstructure:
Manifest:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/MyTheme" >
values-v11:
<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:style/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.Light">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="MyTheme" parent="#android:style/Theme.Holo.Light">
<!-- Any customizations for your app running on devices with Theme.Holo here -->
</style>
other values folders:
<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:style/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.Light">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="MyTheme" parent="#android:style/Theme.Light">
<!-- Any customizations for your app running on devices with Theme.Holo here -->
</style>
How can I use this correctly?
Sincerely
Marco Seiz
Why do you have your theme twice in your styles.xml file?
<style name="AppTheme" parent="#android:style/Theme.Light">
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>
<style name="MyTheme" parent="#android:style/Theme.Holo.Light">
<!-- Any customizations for your app running on devices with Theme.Holo here -->
</style>
Delete the one you don't need(In this case the Theme.Light theme):
values-v11:
<style name="MyTheme" parent="#android:style/Theme.Holo.Light">
<!-- Any customizations for your app running on devices with Theme.Holo here -->
</style>
values:
<style name="MyTheme" parent="#android:style/Theme.Light">
<!-- Any customizations for your app running on devices with Theme.Holo here -->
</style>
Place the solution provided by #Ahmad in new files called themes.xml on the directories he said :-)
If you'll use multilanguage and multithemes, you can take a look at a similar question I did some minutes before... and got answered:
Multilanguage and multitheme at same time