Android Support Library Build v26.X.X Build Error: Attribute “fontFamily” already defined with incompatible format - android

I updated my support build library to 26.x.x from 25.4.0 and i get
AGPBI: {"kind":"error","text":"Original attribute defined here.","sources":[{"file":"/Users/me/AndroidStudioProjects/Mail/mail/build/intermediates/res/merged/dev/debug/values/values.xml","position":{"startLine":40}}],"original":"","tool":"AAPT"}
/Users/me/AndroidStudioProjects/Mail/mail/build/intermediates/res/merged/dev/debug/values/values.xml:373: error: Attribute "fontFamily" already defined with incompatible format.
/Users/me/AndroidStudioProjects/Mail/mail/build/intermediates/res/merged/dev/debug/values/values.xml:41: Original attribute defined here.
I did to clean project->rebuild, invalidate and restart studio, remove prefix android from android:fontFamily(now just fontFamily in item), exclude modules from others libraries (there were conflicts).
My styles.xml:
<style name="CurrentTheme" parent="#style/AppTheme.Base">
<!-- Common styles -->
<item name="android:windowBackground">#color/bg</item>
<item name="android:colorBackground">#color/bg</item>
<item name="android:autoCompleteTextViewStyle">#style/AutoCompleteTextView</item>
<item name="android:actionOverflowButtonStyle">#style/OverFlow.Light</item>
<item name="actionOverflowButtonStyle">#style/OverFlow.Light</item>
<item name="actionModeStyle">#style/MessagesListActionMode</item>
<item name="actionModeCloseDrawable">#drawable/ic_action_cancel</item>
<item name="android:itemTextAppearance">#style/myCustomMenuTextApearance</item>
<item name="searchViewStyle">#style/MySearchViewStyle</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="colorAccent">#color/logo_color</item>
<item name="colorControlNormal">#color/col888</item>
<item name="colorControlActivated">#color/logo_color</item>
<item name="homeAsUpIndicator">#drawable/ab_back_button_bg_states</item>
<item name="alertDialogTheme">#style/CurrentTheme.AlertDialog</item>
<item name="actionMenuTextColor">#color/logo_color</item>
<item name="toolbarStyle">#style/CurrentTheme.Toolbar</item>
</style>
<style name="CurrentTheme.WithoutPreview" parent="CurrentTheme.Transparent" >
<item name="android:windowDisablePreview">true</item>
</style>
<style name="CurrentTheme.Transparent" parent="CurrentTheme" />
<style name="TodoWelcomeTheme" parent="#style/CurrentTheme" />
<style name="CurrentTheme.Toolbar" parent="#style/Widget.AppCompat.Toolbar">
<item name="contentInsetStart">72dp</item>
</style>
<style name="CurrentTheme.AlertDialog" parent="#style/Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">#color/color14</item>
</style>
<style name="CurrentTheme.AlertDialog.ButtonBarStyle" />
<style name="OverFlow.Light" parent="#android:style/Widget.Holo.ActionButton.Overflow">
<item name="android:contentDescription">#string/overflow_expose_cd</item>
<item name="android:src">#drawable/ic_overflow_blue</item>
</style>
<style name="myCustomMenuTextApearance" parent="#android:style/TextAppearance.Widget.IconMenu.Item">
<item name="android:textColor">#drawable/text_selector</item>
</style>
<style name="AppTheme.Base" parent="#style/Theme.AppCompat.Light.DarkActionBar" />
<style name="MySearchViewStyle" parent="Widget.AppCompat.SearchView">
<item name="searchIcon">#android:color/transparent</item>
<item name="closeIcon">#drawable/ic_close_white_24dp</item>
</style>
<style name="MessagesListActionMode" parent="Widget.AppCompat.ActionMode">
<item name="background">#color/toolbar_am_bg</item>
<item name="android:background">#color/toolbar_am_bg</item>
<item name="android:height">56dp</item>
<item name="android:titleTextStyle">#style/ActionModeTitle</item>
</style>
<style name="ActionModeTitle" parent="TextAppearance.AppCompat.Widget.ActionMode.Title">
<item name="android:textColor">#color/actionbar_text_color</item>
<item name="android:textSize">#dimen/font_20pt</item>
<item name="android:textStyle">normal</item>
<item name="fontFamily">#string/font_roboto_medium</item>
</style>
<style name="TestStyle" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorAccent">#color/color2</item>
</style>
<style name="CurrentTheme.Widget" />
<style name="CurrentTheme.Widget.SocialButton">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginRight">5dp</item>
<item name="android:layout_marginLeft">5dp</item>
</style>
<style name="OtherMail.floating_text_view" parent="android:style/Widget.TextView">
<item name="android:textSize">#dimen/font_12pt</item>
<item name="android:textColor">#color/color4</item>
</style>
<style name="OtherMail.edit_text" parent="android:style/Widget.EditText">
<item name="android:textSize">#dimen/font_16pt</item>
<item name="android:singleLine">true</item>
<item name="android:background">#drawable/textedit_bg_state</item>
<item name="android:textColor">#color/color7</item>
<item name="android:textColorHint">#color/color7</item>
</style>
</style>
Etc.
If for right answer i should give you more information, tell me.

I found the library which have incorrect support library version. I excluded support library group(Example this) inside it(or I could remove that library or update its), but it didn't work for me and I update library and(but exclude should work too, i think) my project was built.
Problem:
The library from which the error was thrown out is shown below:
My logs didn't show to me where was the problem(Indirectly, in the generated file there was a mention of roboto).
Decisions:
1) You can exclude group which throws error:
2) Or update it:
I hope my answer will help someone.

Related

Runtime crashes with dexguard 8.2.16

I have a runtime crash in our app probably bound to Dexguard obfuscation. The app has no problems in debug and release mode without obfuscation, however once I generate the signed apk I get this crash at runtime:
java.lang.RuntimeException: Unable to start activity ComponentInfo{it.package.name/it.package.name.login.SignInActivity}: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false }
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2815)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2893)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1614)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:171)
at android.app.ActivityThread.main(ActivityThread.java:6649)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:547)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features: { windowActionBar: false, windowActionBarOverlay: false, android:windowIsFloating: false, windowActionModeOverlay: false, windowNoTitle: false }
at o.ﭥ.ʿ(:469)
at o.ﭥ.ʽॱ(:323)
at o.ﭥ.ˋ(:284)
at o.ᵈ.setContentView(:139)
at it.package.name.login.SignInActivity.onCreate(:61)
Line 61 is a simple setContentView instruction.
Here my styles.xml file:
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#android:color/transparent</item>
<item name="colorPrimaryDark">#color/colorPrimaryGrey</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:textColorHint">#color/hintColor</item>
<item name="android:fontFamily">#font/montserrat_regular</item>
<item name="android:background">#android:color/transparent</item>
</style>
<style name="AppThemeTranslucent" parent="AppTheme">
<!-- Customize your theme here. -->
<item name="android:background">#null</item>
</style>
<style name="DialogFragmentStyle" parent="Base.Theme.AppCompat.Light.Dialog">
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowIsFloating">false</item>
</style>
<style name="RegistrationTheme" parent="AppTheme">
<item name="android:windowBackground">#color/registrationBackgroundColor</item>
<item name="colorPrimaryDark">#color/colorPrimaryDarkGreen</item>
<item name="colorAccent">#color/colorPrimary</item>
<item name="android:windowNoTitle">true</item>
<item name="android:textColorSecondary">#color/colorPrimary</item>
</style>
<style name="RegistrationTitle" parent="RegistrationTheme">
<item name="android:textSize">#dimen/registration_title_font_size</item>
<item name="android:textColor">#color/registrationTitleTextColor</item>
<item name="android:textStyle">bold</item>
</style>
<style name="PopupTitle" parent="RegistrationTitle">
<item name="android:textSize">#dimen/popup_title_font_size</item>
</style>
<style name="PermissionButton" parent="Base.Widget.AppCompat.Button.Borderless">
<item name="android:height">56dp</item>
<item name="android:textColor">#color/registrationTitleTextColor</item>
<item name="android:textSize">14sp</item>
<item name="android:textAllCaps">false</item>
<item name="android:padding">0dp</item>
</style>
<style name="PopupSubtitle" parent="RegistrationAbstract">
<item name="android:textSize">#dimen/popup_subtitle_font_size</item>
</style>
<style name="RegistrationAbstract" parent="RegistrationTheme">
<item name="android:textSize">#dimen/registration_abstract_font_size</item>
<item name="android:textColor">#color/registrationTitleTextColor</item>
<item name="android:lineSpacingExtra">#dimen/registration_abstract_spacing_extra</item>
</style>
<style name="RegistrationEditText" parent="RegistrationTheme">
<item name="android:textStyle">bold</item>
<item name="android:textColor">#color/colorPrimary</item>
<item name="android:background">#android:color/white</item>
<item name="android:paddingStart">#dimen/activity_horizontal_margin</item>
<item name="android:paddingEnd">#dimen/activity_horizontal_margin</item>
<item name="android:paddingTop">#dimen/base_padding</item>
<item name="android:paddingBottom">#dimen/base_padding</item>
<item name="android:minHeight">#dimen/edit_text_min_height</item>
</style>
<style name="FabStyle" parent="RegistrationTheme">
<item name="colorAccent">#android:color/white</item>
</style>
<style name="AndroidImageSlider_Magnifier_Oval_Green">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:gravity">center</item>
<item name="android:paddingLeft">5dp</item>
<item name="android:paddingRight">5dp</item>
<item name="shape">oval</item>
<item name="padding_left">6dp</item>
<item name="padding_right">6dp</item>
<item name="padding_top">4dp</item>
<item name="padding_bottom">4dp</item>
<item name="selected_color">#color/green</item>
<item name="unselected_color">#95D8B9</item>
<item name="selected_width">10dp</item>
<item name="selected_height">10dp</item>
<item name="unselected_width">10dp</item>
<item name="unselected_height">10dp</item>
</style>
<style name="CustomToggleButton" parent="Widget.AppCompat.Button">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:background">#null</item>
<item name="android:minHeight">0dp</item>
<item name="android:minWidth">0dp</item>
<item name="android:padding">10dp</item>
<item name="android:textAllCaps">false</item>
<item name="android:textOff">#string/SignIn_HidePassword_Button</item>
<item name="android:textOn">#string/SignIn_ShowPassword_Button</item>
</style>
<style name="ThemeOverlay.AppCompat.navTheme">
<!-- Color of text and icon when SELECTED -->
<item name="colorPrimary">#color/colorPrimary</item>
<!-- Background color when SELECTED -->
<item name="colorControlHighlight">#android:color/transparent</item>
</style>
<style name="DefaultCardLayout">
<item name="android:background">#color/white</item>
<item name="android:paddingStart">13dp</item>
<item name="android:paddingEnd">13dp</item>
<item name="android:paddingTop">22dp</item>
<item name="android:paddingBottom">22dp</item>
</style>
<style name="MyCustomTabLayout" parent="Widget.Design.TabLayout">
<!--<item name="tabMaxWidth">#dimen/tab_max_width</item>-->
<item name="tabIndicatorColor">#color/colorPrimary</item>
<item name="tabIndicatorHeight">2dp</item>
<item name="tabPaddingStart">12dp</item>
<item name="tabPaddingEnd">12dp</item>
<item name="tabBackground">?attr/selectableItemBackground</item>
<item name="tabTextAppearance">#style/MyCustomTabTextAppearance</item>
<item name="tabSelectedTextColor">?android:textColorPrimary</item>
</style>
<style name="MyCustomTabTextAppearance" parent="TextAppearance.Design.Tab">
<item name="android:textSize">14sp</item>
<item name="android:textColor">?android:textColorSecondary</item>
<item name="textAllCaps">false</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<!-- Splash Screen theme. -->
<style name="SplashTheme" parent="Theme.AppCompat.NoActionBar">
<item name="android:windowBackground">#drawable/splash_background</item>
</style>
<style name="GreenText" parent="AppTheme">
<item name="android:textColor">#color/green</item>
<item name="android:textStyle">bold</item>
</style>
<style name="DarkGreenText" parent="AppTheme">
<item name="android:textColor">#color/zehus_dark_green</item>
<item name="android:textStyle">bold</item>
</style>
<style name="CheckboxStyle" parent="Widget.AppCompat.CompoundButton.CheckBox">
<item name="android:button">#drawable/custom_checkbox</item>
</style>
<style name="StartRentalStyle" parent="Widget.AppCompat.Button.Colored">
<item name="colorControlNormal">#color/green</item>
<item name="android:textColor">#color/white</item>
</style>
<style name="GreenTint" parent="ThemeOverlay.AppCompat.Dark">
<!-- customize colorButtonNormal for the disable color -->
<!-- customize colorAccent for the enabled color -->
<item name="colorButtonNormal">#color/zehus_dark_green_disabled</item>
<item name="colorAccent">#color/zehus_dark_green</item>
<item name="textColor">#color/white</item>
<item name="textAllCaps">false</item>
</style>
<style name="BookedTint" parent="Widget.AppCompat.Button.Colored">
<item name="colorControlNormal">#color/base_orange</item>
<item name="textColor">#color/white</item>
<item name="textAllCaps">false</item>
</style>
<style name="WhiteTint" parent="Widget.AppCompat.Button.Colored">
<item name="colorControlNormal">#color/white</item>
<item name="textAllCaps">false</item>
</style>
</resources>
Here there is styles.xml (v21)
<resources>
<style name="StartRentalStyle" parent="Base.Widget.AppCompat.Button">
<item name="android:backgroundTint">#color/green</item>
<item name="android:textColor">#color/white</item>
</style>
<style name="AppThemeTranslucent" parent="AppTheme">
<!-- Customize your theme here. -->
<item name="android:navigationBarColor">#android:color/transparent</item>
<item name="android:statusBarColor">#android:color/transparent</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:background">#null</item>
</style>
</resources>
I've already written to DexGuard support, waiting for a response. Does anybody have a clue?
I've been stuck on this for the better part of a week and have had to disable Dexguard on builds, but I finally figured it out. I hope this works for you too.
The issue appears to be in the new(ish) D8 desugar-er, which replaced the old DX version. D8 is enabled by default in Android Studio 3.x. As such it is required to build project correctly (as far as I can make out, this article helped understand that).
What worked for me was removing this line from gradle.properies, the project-wide Gradle settings:
android.enableD8.desugaring=false
I had been ignoring the following warning from Gradle's sync phase output:
WARNING: The option setting 'android.enableD8.desugaring=false' is experimental and unsupported.
I guess don't ignore the warnings is my lesson here! I couldn't find any really good information about why this causes the issue to happen, but it makes sense that it would be in this area considering that D8 is the dexer, and Dexguard is of course also impacting on dexing.
I'd like to also share with you the surface level cause of the crash as it might be useful to know, and I'm certainly happy I looked deeply at it.
For AppCompatActivity activities, setContentView(...) is handled by AppCompatDelegateImpl concrete class which implements setContentView. On first time set up it will createSubDecor() to set up the Window root ViewGroup.
The failing case here that we have both experienced is that the last condition here fails:
private ViewGroup createSubDecor() {
TypedArray a = mContext.obtainStyledAttributes(R.styleable.AppCompatTheme);
if (!a.hasValue(R.styleable.AppCompatTheme_windowActionBar)) {
a.recycle();
throw new IllegalStateException(
"You need to use a Theme.AppCompat theme (or descendant) with this activity.");
}
if (a.getBoolean(R.styleable.AppCompatTheme_windowNoTitle, false)) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
} else ...
So the attribute for windowNoTitle is not read incorrectly as missing, and so defaults to false, even though it should be true. This is why the advice saying to use the following Theme attributes will not work, dexing (or desugaring, or some part of this) messes it up.
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
In any case if you are sub-Theming Theme.AppCompat.Light.NoActionBar then these are already set and you shouldn't need to. I lost some time going down this route, e.g. here, here, here, here and here.
The error then occurs because there is no default condition case if !mWindowNoTitle && !(mIsFloating || mHasActionBar), as you can see in this simplified version of the code that inflates the subDecor ViewGroup:
if (!mWindowNoTitle) {
if (mIsFloating) {
subDecor = ...
} else if (mHasActionBar) {
subDecor = ...
}
// else, nothing! subDecor remains null, problem case
} else {
if (mOverlayActionMode) {
subDecor = ...
} else {
subDecor = ...
}
}
if (subDecor == null) {
throw new IllegalArgumentException(
"AppCompat does not support the current theme features: { "
+ ....);
}
So basically we need mWindowNoTitle to be true. Incidentally it has actually not set here, it's set by requestWindowFeature(Window.FEATURE_NO_TITLE), which is exactly what is called if we have the windowNoTitle attribute set to true, as expected. There is some advice suggesting calling it manually, but this ultimately doesn't work, as there are in fact I think other problems, this is just the first that gets hit.
So that's why and how it happens. The fix is not directly related, so as I said at the start, look at your D8 configuration. There's also a chance you need to update your Dexguard config or version, it has been a nightmare managing Gradle versions with Dexguard versions, Android Studio versions... it's difficult. Hopefully this helps you and is of interest to others.

Xamarin Forms : Android Build Error

I am trying to build an android project of a Xamarin Forms project. But getting the error as in image 1.
I am targeting Android 26 and building against build tool 26.0.2.
I have shared the details of SDK and installed packages.
I have tried clearing all the Nuget cache, deleting obj and bins in all the projects, installing the V7.AppCompact package manually.
Can anyone help me on this.I know this is a very common issue but I dont know what I am doing wrong.
Styles.Xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Splash" parent="android:Theme">
<item name="android:windowBackground">#drawable/a</item>
<item name="android:windowNoTitle">true</item>
</style>
<style name="MainTheme" parent="MainTheme.Base">
</style>
<!-- Base theme applied no matter what API -->
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="colorPrimary">#color/primary</item>
<item name="colorPrimaryDark">#color/primaryDark</item>
<item name="colorAccent">#color/accent</item>
<item name="android:colorActivatedHighlight">#android:color/transparent</item>
<item name="windowActionModeOverlay">true</item>
<item name="alertDialogTheme">#style/AppCompatAlertDialogStyle</item>
<item name="android:alertDialogTheme">#style/AppCompatAlertDialogStyle</item>
<item name="android:datePickerDialogTheme">#style/AppCompatDateStyle</item>
<item name="android:timePickerDialogTheme">#style/AppCompatDateStyle</item>
<item name="colorControlNormal">#color/primaryDark</item>
<item name="colorControlActivated">#color/primary</item>
</style>
<style name="AppCompatDateStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="colorAccent">#color/primary</item>
<item name="colorPrimary">#color/primary</item>
<item name="colorPrimaryDark">#color/primaryDark</item>
</style>
<style name="AppCompatAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">#color/primary</item>
</style>
</resources>

debug/AndroidManifest.xml elements not recognized during build in AndroidStudio

I am working on porting an existing app to a new setup and I got almost everything working, but when I tried to build the project, I got the error that some of the elements in the debug/AndroidManifest.xml are not recognized. Here are some screenshots:
Any idea why that might be happening and how to fix that?
This is my styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomTheme" parent="android:Theme.Light">
<item name="android:windowBackground">#color/white</item>
<item name="android:colorBackground">#color/white</item>
</style>
<style name="home_page_buttons">
<item name="android:layout_marginLeft">10dp</item>
<item name="android:layout_marginRight">10dp</item>
<item name="android:textStyle">bold</item>
<item name="android:color">#color/white</item>
<item name="android:layout_height">45dip</item>
<!-- <item name="android:background">#drawable/white_button</item> -->
</style>
<style name="home_page_two_buttons">
<item name="android:textStyle">bold</item>
<item name="android:color">#color/white</item>
<item name="android:layout_height">45dip</item>
<!-- <item name="android:background">#drawable/white_button</item> -->
</style>
<!-- Information Pages -->
<style name="instruction_text">
<item name="android:padding">10px</item>
<item name="android:textSize">16sp</item>
</style>
<style name="instruction_quote">
<item name="android:padding">10px</item>
<item name="android:textSize">12sp</item>
</style>
<style name="instruction_heading">
<item name="android:padding">10px</item>
<item name="android:textSize">17sp</item>
<item name="android:textColor">#color/light_best_blue</item>
</style>
</resources>
You mentioned the android:theme as "AppBaseTheme" but i do not see that style in your style.xml file.

AppCompat Custom theme not applying

I generated a custom theme using the Android Asset Studio Actionbar styling tool. I am not able to view the theme. I only get the AppCompat.Light or AppCompat.Light.DarkActionBar base theme in my app. (I also referred to this article Theme not applied using appcompat library on some Android 4.X devices)
My values/styles.xml
<style name="Theme.Betbuds" parent="#style/Theme.AppCompat.Light">
<item name="actionBarItemBackground">#drawable/selectable_background_betbuds</item>
<item name="popupMenuStyle">#style/PopupMenu.Betbuds</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Betbuds</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Betbuds</item>
<item name="actionDropDownStyle">#style/DropDownNav.Betbuds</item>
<item name="actionBarStyle">#style/ActionBar.Solid.Betbuds</item>
<item name="actionModeBackground">#drawable/cab_background_top_betbuds</item>
<item name="actionModeSplitBackground">#drawable/cab_background_bottom_betbuds</item>
<item name="actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Betbuds</item>
</style>
<style name="ActionBar.Solid.Betbuds" parent="#style/Widget.AppCompat.Light.ActionBar.Solid">
<item name="background">#drawable/ab_solid_betbuds</item>
<item name="backgroundStacked">#drawable/ab_stacked_solid_betbuds</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_betbuds</item>
<item name="progressBarStyle">#style/ProgressBar.Betbuds</item>
</style>
<style name="ActionBar.Transparent.Betbuds" parent="#style/Widget.AppCompat.Light.ActionBar">
<item name="background">#drawable/ab_transparent_betbuds</item>
<item name="progressBarStyle">#style/ProgressBar.Betbuds</item>
</style>
<style name="PopupMenu.Betbuds" parent="#style/Widget.AppCompat.Light.PopupMenu">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_betbuds</item>
</style>
<style name="DropDownListView.Betbuds" parent="#style/Widget.AppCompat.Light.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_betbuds</item>
</style>
<style name="ActionBarTabStyle.Betbuds" parent="#style/Widget.AppCompat.Light.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_betbuds</item>
</style>
<style name="DropDownNav.Betbuds" parent="#style/Widget.AppCompat.Light.Spinner.DropDown.ActionBar">
<item name="android:background">#drawable/spinner_background_ab_betbuds</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_betbuds</item>
<item name="android:dropDownSelector">#drawable/selectable_background_betbuds</item>
</style>
<style name="ProgressBar.Betbuds" parent="#style/Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_betbuds</item>
</style>
<style name="ActionButton.CloseMode.Betbuds" parent="#style/Widget.AppCompat.Light.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_betbuds</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Betbuds.Widget" parent="#style/Theme.AppCompat">
<item name="popupMenuStyle">#style/PopupMenu.Betbuds</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Betbuds</item>
</style>
My values-v14/styles.xml
<style name="Theme.Betbuds" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarItemBackground">#drawable/selectable_background_betbuds</item>
<item name="android:popupMenuStyle">#style/PopupMenu.Betbuds</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.Betbuds</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle.Betbuds</item>
<item name="android:actionDropDownStyle">#style/DropDownNav.Betbuds</item>
<item name="android:actionBarStyle">#style/ActionBar.Solid.Betbuds</item>
<item name="android:actionModeBackground">#drawable/cab_background_top_betbuds</item>
<item name="android:actionModeSplitBackground">#drawable/cab_background_bottom_betbuds</item>
<item name="android:actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Betbuds</item>
</style>
<style name="ActionBar.Solid.Betbuds" parent="#style/Widget.AppCompat.Light.ActionBar.Solid">
<item name="android:background">#drawable/ab_solid_betbuds</item>
<item name="android:backgroundStacked">#drawable/ab_stacked_solid_betbuds</item>
<item name="android:backgroundSplit">#drawable/ab_solid_betbuds</item>
<item name="android:progressBarStyle">#style/ProgressBar.Betbuds</item>
</style>
<style name="ActionBar.Transparent.Betbuds" parent="#style/Widget.AppCompat.Light.ActionBar">
<item name="android:background">#drawable/ab_transparent_betbuds</item>
<item name="android:progressBarStyle">#style/ProgressBar.Betbuds</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Betbuds.Widget" parent="#style/Theme.AppCompat">
<item name="android:popupMenuStyle">#style/PopupMenu.Betbuds</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.Betbuds</item>
</style>
</resources>
The Android Studio preview also shows only the Base themes. I have the following in my Manifest
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Betbuds" >
I realise that there are a lot of questions similar to this. I am not able to figure out an answer. Any help is appreciated. Thanks.

Change generated action bar theme from Android Asset Studio

I have used Android Asset Studio to generate action bar style, however i woul like to do some changes, which I was unable to do in Studio, so I edited generated theme but lot of things was just ignored, and I just can't figure out how things work.
There is example:
`
<style name="Theme.Myactionbar" parent="#style/Theme.AppCompat.Light">
<item name="actionBarItemBackground">#drawable/selectable_background_myactionbar</item>
<item name="popupMenuStyle">#style/PopupMenu.Myactionbar</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Myactionbar</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Myactionbar</item>
<item name="actionDropDownStyle">#style/DropDownNav.Myactionbar</item>
<item name="actionBarStyle">#style/ActionBar.Solid.Myactionbar</item>
<item name="actionModeBackground">#drawable/cab_background_top_myactionbar</item>
<item name="actionModeSplitBackground">#drawable/cab_background_bottom_myactionbar</item>
<item name="actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Myactionbar</item>
</style>
<style name="ActionBar.Solid.Myactionbar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid">
<item name="background">#drawable/ab_solid_myactionbar</item> //THIS IS GREEN
<item name="backgroundStacked">#drawable/ab_solid_myactionbar</item>//THIS IS GREEN
<item name="backgroundSplit">#drawable/ab_bottom_solid_myactionbar</item>//THIS IS GREEN
<item name="progressBarStyle">#style/ProgressBar.Myactionbar</item>
</style>
<style name="ActionBar.Transparent.Myactionbar" parent="#style/Widget.AppCompat.Light.ActionBar">
<item name="background">#drawable/ab_transparent_myactionbar</item>
<item name="progressBarStyle">#style/ProgressBar.Myactionbar</item>
</style>
<style name="PopupMenu.Myactionbar" parent="#style/Widget.AppCompat.Light.PopupMenu">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_example </item>
</style>
<style name="DropDownListView.Myactionbar" parent="#style/Widget.AppCompat.Light.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_myactionbar</item>
</style>
<style name="ActionBarTabStyle.Myactionbar" parent="#style/Widget.AppCompat.Light.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_myactionbar</item>
</style>
<style name="DropDownNav.Myactionbar" parent="#style/Widget.AppCompat.Light.Spinner.DropDown.ActionBar">
<item name="android:background">#drawable/spinner_background_ab_myactionbar</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_myactionbar</item>
<item name="android:dropDownSelector">#drawable/selectable_background_myactionbar</item>
</style>
<style name="ProgressBar.Myactionbar" parent="#style/Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_myactionbar</item>
</style>
<style name="ActionButton.CloseMode.Myactionbar" parent="#style/Widget.AppCompat.Light.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_myactionbar</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Myactionbar.Widget" parent="#style/Theme.AppCompat">
<item name="popupMenuStyle">#style/PopupMenu.Myactionbar</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Myactionbar</item>
</style>
Everything was like in generator, but then i tried the simplest change, that is the color, so I edited style name=ActionBar.Solid.Myactionbar and put there som other drawables from other generated style.
It looked like this :
<style name="Theme.Myactionbar" parent="#style/Theme.AppCompat.Light">
<item name="actionBarItemBackground">#drawable/selectable_background_myactionbar</item>
<item name="popupMenuStyle">#style/PopupMenu.Myactionbar</item>
<item name="dropDownListViewStyle">#style/DropDownListView.Myactionbar</item>
<item name="actionBarTabStyle">#style/ActionBarTabStyle.Myactionbar</item>
<item name="actionDropDownStyle">#style/DropDownNav.Myactionbar</item>
<item name="actionBarStyle">#style/ActionBar.Solid.Myactionbar</item>
<item name="actionModeBackground">#drawable/cab_background_top_myactionbar</item>
<item name="actionModeSplitBackground">#drawable/cab_background_bottom_myactionbar</item>
<item name="actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Myactionbar</item>
</style>
<style name="ActionBar.Solid.Myactionbar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid">
<item name="background">#drawable/ab_solid_example</item>
<item name="backgroundStacked">#drawable/ab_stacked_solid_example</item>
<item name="backgroundSplit">#drawable/ab_bottom_solid_myactionbar</item>
<item name="progressBarStyle">#style/ProgressBar.Myactionbar</item>
</style>
but nothing happend, and changed drawables supposed to be gray. I was wandering if anybody did this before and why this isnt working? Thank you
Ok I figured it out, there is values-v14 folder for styles for api level 14 and above, so you have to change these values too.

Categories

Resources