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.
Related
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.
I know that you can globally set control themes using a styles.xml and referencing a theme for activities.
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="colorPrimary">#color/PrimaryColor</item>
<item name="colorPrimaryDark">#color/PrimaryDarkColor</item>
<item name="colorAccent">#color/SecondaryColor</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:statusBarColor">#color/PrimaryDarkColor</item>
<item name="android:textColor">#color/PrimaryTextColor</item>
<item name="android:datePickerStyle">#style/datepicker</item>
<item name="android:textViewStyle">#style/textView</item>
<item name="android:spinnerStyle">#style/spinner</item>
<item name="android:checkBoxStyle">#style/CheckboxStyle</item>
<item name="android:dropDownListViewStyle">#style/DropDownStyle</item>
</style>
<style name="datepicker">
<item name="colorPrimary">#color/PrimaryColor</item>
<item name="colorPrimaryDark">#color/PrimaryDarkColor</item>
<item name="colorAccent">#color/SecondaryColor</item>
</style>
<style name="spinner">
<item name="android:background">#drawable/SpinnerBackground</item>
</style>
<style name="textView" parent="android:Widget.TextView">
<item name="android:textSize">#dimen/defaultTextViewSize</item>
</style>
<style name="DialogThemeButton">
<item name="android:background">#color/PrimaryDarkColor</item>
</style>
<style name="DialogThemeTextAppearance">
<item name="android:textColor">#color/PrimaryTextColor</item>
</style>
<style name="DropDownStyle" parent="android:Widget.ListView.DropDown">
<item name="android:divider">#drawable/SpinnerDivider</item>
<item name="android:dividerHeight">1dp</item>
</style>
<style name="CheckBoxStyle" parent="android:Widget.ListView.DropDown">
<item name="android:divider">#drawable/SpinnerDivider</item>
<item name="android:dividerHeight">1dp</item>
</style>
<style name="DialogTheme" parent="Theme.AppCompat.Dialog.Alert">
<item name="android:background">#android:color/white</item>
<item name="colorAccent">#color/PrimaryDarkColor</item>
<item name="android:textColor">#color/PrimaryDarkColor</item>
<item name="android:textColorPrimary">#color/PrimaryTextColor</item>
<!-- <item name="android:textAppearanceMedium">#style/DialogThemeTextAppearance</item>-->
<item name="android:buttonBarButtonStyle">#style/DialogThemeButton</item>
</style>
</resources>
Question:
Is there some way to find the appropriate item names for any kind of control?
I think i should be able to find it on google using my question, but i cannot.
A strict pattern would have been nice but i guess that'll do:
GitHub Sources:
https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/styles.xml
https://github.com/android/platform_frameworks_base/blob/master/core/res/res/values/themes.xml
Google Sources:
https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/styles.xml
https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/res/res/values/themes.xml
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.
I am trying to style the TabBar using the following code:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="MyTheme" parent="MyTheme.Base"/>
<style name="MyTheme.Base" parent="Theme.AppCompat">
<item name="colorPrimary">#color/palette_1</item>
<item name="colorPrimaryDark">#color/palette_5</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">true</item>
<item name="android:windowBackground">#color/palette_1</item>
<item name="android:actionBarStyle">#style/MyTheme.ActionBar</item>
<item name="actionBarStyle">#style/MyTheme.ActionBar</item>
<item name="actionBarTabStyle">#style/MyTheme.ActionBarTabBar</item>
<item name="android:actionBarTabStyle">#style/MyTheme.ActionBarTabBar</item>
</style>
<style name="MyTheme.ActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">#color/palette_5</item>
<item name="backgroundStacked">#color/palette_5</item>
<item name="backgroundSplit">#color/palette_5</item>
</style>
<style name="MyTheme.ActionBarTabBar" parent="#style/Widget.AppCompat.ActionBar.TabView">
<item name="android:background">#color/palette_5</item>
</style>
<style name="MyTheme.NoTitleBar" parent="MyTheme">
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
</resources>
Whewre palette_1 is green and palette_5 is blue for example.
The actionBar is blue but the tabbar stays the color that i define in android:windowBackground, which is green.
This is the code i came up with after searching numerous topics. But yet it seems to be conflicting somewhere.
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.