How can I remove this white background? It only appers in tablets...
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppBaseTheme" parent="android:Theme.Light"></style>
<style name="AppTheme" parent="AppBaseTheme"></style>
<style name="MyTheme" parent="Theme.Sherlock.Light">
<item name="actionBarStyle">#style/Widget.Styled.ActionBar</item>
<item name="android:actionBarStyle">#style/Widget.Styled.ActionBar</item>
<item name="android:actionModeBackground">#drawable/bg_actionbar</item>
<item name="actionModeBackground">#drawable/bg_actionbar</item>
<item name="actionModeCloseDrawable">#drawable/abs__ic_cab_done_holo_dark</item>
<item name="android:windowContentOverlay">#null</item>
<!--<item name="android:homeAsUpIndicator">#drawable/icon_actionbar_back</item>-->
</style>
<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
<item name="background">#drawable/bg_actionbar</item>
<item name="android:background">#drawable/bg_actionbar</item>
</style>
</resources>
Thanks for your time.
Related
When selecting the datepicker control in Xamarin Forms on an android device the Calendar Mode view of the datepicker is shown. How can I change it to show the Spinner Mode?
The only sample I found was to update my styles.xml
Here is what I have, which is not working
<resources>
<style name="MyTheme.Base"
parent="#android:style/Theme.Holo.Light.DarkActionBar">
</style>
<style name="MyTheme" parent="MyTheme.Base">
<item name="android:actionBarStyle">#style/MyTheme.ActionBarStyle</item>
<item name="android:dialogTheme">#style/MyDialogTheme</item>
<item name="android:datePickerStyle">#style/MyDatePicker</item>
</style>
<style name="MyTheme.ActionBarStyle"
parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:titleTextStyle">#style/MyTheme.ActionBar.TitleTextStyle</item>
<item name="android:background">#color/material_blue_500</item>
</style>
<style name="MyTheme.ActionBar.TitleTextStyle" parent="#android:style/TextAppearance.Holo.Widget.ActionBar.Title">
<item name="android:textColor">#android:color/white</item>
</style>
<style name="MyDialogTheme" parent="android:Theme.Material.Dialog">
<item name="android:datePickerStyle">#style/MyDatePicker</item>
</style>
<style name="MyDatePicker" parent="android:Widget.Material.DatePicker">
<item name="android:datePickerMode">spinner</item>
</style>
</resources>
Here is the Resources/values/styles.xml that worked for me
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MyTheme.Base" parent="#android:style/Theme.Holo.Light.DarkActionBar">
<item name="android:dialogTheme">#style/MyDialogTheme</item>
</style>
<style name="MyTheme" parent="MyTheme.Base">
<item name="android:actionBarStyle">#style/MyTheme.ActionBarStyle</item>
<item name="android:dialogTheme">#style/MyDialogTheme</item>
</style>
<style name="MyDialogTheme" parent="android:Theme.Material.Dialog">
<item name="android:datePickerStyle">#style/MyDatePicker</item>
</style>
<style name="MyDatePicker" parent="android:Widget.Material.DatePicker">
<item name="android:datePickerMode">spinner</item>
</style>
<style name="cust_tabViewStyle">
<item name="android:textColor">#color/material_blue_500</item>
</style>
</resources>
Then set the theme in the Properties/AndroidManifest.xml by modifying the application node to this
<application android:label="MyApp" android:icon="#drawable/Icon" android:theme="#style/MyTheme">
If you are using AppCompat, try this:
<resources>
<style name="MyTheme" parent="MyTheme.Base">
</style>
<style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:datePickerDialogTheme">#style/AppCompatDialogStyle</item>
</style>
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="android:datePickerStyle">#style/style_date_picker</item>
</style>
<style name="style_date_picker" parent="android:Widget.Material.Light.DatePicker">
<item name="android:datePickerMode">spinner</item>
</style>
</resources>
Firstly you create DatePicker Style in Style.xml
<style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="android:datePickerStyle">#style/style_date_picker</item>
</style>
<style name="style_date_picker" parent="android:Widget.Material.Light.DatePicker">
<item name="android:datePickerMode">spinner</item>
</style>
Then You are calling package named datePickerDialogTheme for AppCompatDialogStyle
It was like
<style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:datePickerDialogTheme">#style/AppCompatDialogStyle</item>
</style>
This will work for you.
I'd like to remove shadow around my action bar overflow menu, but i haven't found any attributes allowing that. I'm extending Theme.AppCompat.
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
<item name="actionOverflowButtonStyle">#style/OverflowButton</item>
<item name="actionOverflowMenuStyle">#style/OverflowMenu</item>
<item name="actionBarStyle">#style/MyActionBarLogo</item>
<item name="android:dropDownListViewStyle">#style/PopupMenuListView</item>
<item name="dropDownListViewStyle">#style/PopupMenuListView</item>
<item name="android:textColor">#color/black</item>
<item name="android:popupMenuStyle">#style/PopupMenu</item>
</style>
<style name="MyActionBarLogo" parent="Widget.AppCompat.ActionBar">
<item name="background">#color/white</item>
<item name="displayOptions">useLogo|showHome</item>
<item name="elevation">0dp</item>
<item name="android:windowContentOverlay">#null</item>
</style>
<style name="OverflowButton" parent="#style/Widget.AppCompat.ActionButton.Overflow">
<item name="android:src">#mipmap/menu_logo</item>
</style>
<style name="OverflowMenu" parent="#style/Widget.AppCompat.PopupMenu.Overflow">
<item name="overlapAnchor">false</item>
<item name="android:dropDownVerticalOffset">52dp</item>
<item name="android:dropDownHorizontalOffset">10dp</item>
</style>
<style name="PopupMenuListView" parent="#style/Widget.AppCompat.ListView.DropDown">
<item name="android:divider">#drawable/menu_divider</item>
<item name="android:dividerHeight">1dp</item>
<item name="android:textColor">#color/black</item>
<item name="android:background">#color/white</item>
</style>
<style name="PopupMenu" parent="#style/Widget.AppCompat.ListPopupWindow">
<item name="android:popupBackground">#color/white</item>
</style>
http://imgur.com/5mbceT9
You can try solution this
getSupportActionBar().setElevation(0);
UPDATE
<style name="MyActionBarLogo" parent="Widget.AppCompat.ActionBar">
<item name="background">#color/white</item>
<item name="displayOptions">useLogo|showHome</item>
<item name="elevation">0dp</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:actionDropDownStyle">#style/DropDownMenuStyle</item>
</style>
<style name="DropDownMenuStyle" parent="Widget.AppCompat.Spinner.DropDown.ActionBar">
<item name="android:background">#android:color/transparent</item>
</style>
You need to apply the zero elevation style to the correct element, in this case actionOverflowMenuStyle.
(This is using appcompat)
<style name="Theme.myapp" parent="Theme.AppCompat.Light">
<item name="actionOverflowMenuStyle">#style/Theme.myapp.Widget.PopupMenu.Overflow</item>
</style>
Then
<style name="Theme.myapp.Widget.PopupMenu.Overflow" parent="Widget.AppCompat.PopupMenu.Overflow">
<item name="elevation">0dp</item>
<item name="android:popupElevation">0dp</item>
</style>
Non of the solutions provided worked for me so i decided to make my own question.
I want to change the text inside the cyan area to white without changing the text of the spinner items
Themes.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base application theme. -->
<!-- the theme applied to the application or activity -->
<style name="LibetasTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/ActionBar</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle</item>
<item name="android:actionBarTabBarStyle">#style/ActionBarTabBarStyle</item>
<item name="android:actionBarTabTextStyle">#style/ActionBarTabTextStyle</item>
<item name="android:actionBarItemBackground">#drawable/libertasapp_actionbar_item_background</item>
<item name="android:actionBarWidgetTheme">#style/Theme.stylingactionbar.widget</item>
<item name="android:actionDropDownStyle">#style/DropDownNav</item>
<item name="android:popupMenuStyle">#style/PopupMenu</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView</item>
<item name="android:spinnerDropDownItemStyle">#style/DropDownItem</item>
<item name="android:spinnerItemStyle">#style/SpinnerItem</item>
<item name="android:listSeparatorTextViewStyle">#style/PreferenceListHeader</item>
<item name="android:actionOverflowButtonStyle">#style/MyActionButtonOverflow</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:actionModeBackground">#color/libertas_orange</item>
</style>
</resources>
Styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- ActionBar styles-->
<style name="ActionBar" parent="#android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/libertas_orange</item>
<item name="android:backgroundStacked">#color/libertas_white</item>
<item name="android:backgroundSplit">#color/libertas_orange</item>
<item name="android:indeterminateProgressStyle">#style/ActionBarProgressBar.MyStyle</item>
</style>
<style name="ActionBarTabTextStyle" parent="android:Widget.Holo.Light.ActionBar.TabText">
<item name="android:textColor">#color/libertas_gray</item>
</style>
<style name="ActionBarTabBarStyle" parent="#android:style/Widget.Holo.Light.ActionBar.TabBar">
<item name="android:showDividers">none</item>
</style>
<style name="ActionBarTabStyle" parent="#android:style/Widget.Holo.ActionBar.TabView">
<item name="android:background">#drawable/libertasapp_actionbar_tab_indicator</item>
</style>
<style name="PopupMenu" parent="#android:style/Widget.Holo.ListPopupWindow">
<item name="android:popupBackground">#drawable/img_menu_dropdown_panel</item>
</style>
<style name="DropDownListView" parent="#android:style/Widget.Holo.ListView.DropDown">
<item name="android:listSelector">#color/libertas_dark_orange</item>
</style>
<style name="Theme.stylingactionbar.widget" parent="#android:style/Theme.Holo">
<item name="android:popupMenuStyle">#style/PopupMenu</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView</item>
</style>
<style name="DropDownNav" parent="#android:style/Widget.Holo.Spinner">
<item name="android:background">#drawable/libertasapp_spinner_background_ab</item>
<item name="android:popupBackground">#drawable/img_menu_dropdown_panel</item>
<item name="android:dropDownSelector">#android:color/black</item>
</style>
<style name="DropDownItem" parent="#android:style/Widget.Holo.Light.DropDownItem.Spinner">
<item name="android:textAppearance">?android:attr/textAppearanceInverse</item>
</style>
<style name="SpinnerItem" parent="#android:style/Widget.Holo.TextView.SpinnerItem">
<item name="android:textAppearance">?android:attr/textAppearanceInverse</item>
</style>
<!-- End ActionBar styles-->
<!-- Text styles-->
<style name="BusNumber" parent="#android:style/TextAppearance.Large">
<item name="android:textColor">#color/libertas_orange</item>
<item name="android:textSize">60dp</item>
</style>
<style name="BusLine" parent="#android:style/TextAppearance.Large">
<item name="android:textColor">#color/libertas_text_lightgray</item>
<item name="android:textSize">22dp</item>
</style>
<style name="BusNext" parent="#android:style/TextAppearance.Large">
<item name="android:textColor">#color/libertas_text_darkgray</item>
<item name="android:textSize">16dp</item>
<item name="android:textStyle">bold</item>
</style>
<style name="BusNextTime" parent="#android:style/TextAppearance.Large">
<item name="android:textColor">#color/libertas_text_darkgray</item>
<item name="android:textSize">16dp</item>
<item name="android:textStyle">bold</item>
</style>
<!-- End Text styles-->
<!-- Styling loading animation-->
<style name="ActionBarProgressBar.MyStyle" parent="#android:style/Widget.Holo.ProgressBar.Small">
<item name="android:minWidth">24dp</item>
<item name="android:maxWidth">24dp</item>
<item name="android:minHeight">24dp</item>
<item name="android:maxHeight">24dp</item>
</style>
<!-- End styling loading animation-->
<style name="Widget.TextView.ListSeparator" parent="#android:style/Widget.TextView">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">14sp</item>
<item name="android:gravity">center_vertical</item>
</style>
<style name="PreferenceListHeader" parent="Widget.TextView.ListSeparator">
<item name="android:textColor">#color/libertas_orange</item>
<item name="android:textAllCaps">true</item>
<item name="android:background">#drawable/img_list_category</item>
<item name="android:paddingTop">#dimen/list_category_padding_top</item>
<item name="android:paddingBottom">#dimen/list_category_padding_bottom</item>
</style>
<style name="MyActionButtonOverflow" parent="android:style/Widget.Holo.ActionButton.Overflow">
<item name="android:src">#drawable/img_ic_overflow_white_16</item>
</style>
</resources>
Have you tried setting the spinnerItemStyle as a child of actionBarWidgetTheme? Something like this:
<style name="LibetasTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<item name="android:actionBarWidgetTheme">#style/myapp.actionBarWidgetTheme</item>
</style>
<style name="Theme.stylingactionbar.widget" parent="#android:style/Theme.Holo">
<item name="android:spinnerItemStyle">#style/SpinnerItem</item>
<item name="android:spinnerDropDownItemStyle">#style/SpinnerDropDownItem</item>
</style>
<style name="SpinnerItem" parent="#android:style/Widget.TextView.SpinnerItem">
<item name="android:textColor">#FFFFFF</item>
</style>
<style name="SpinnerDropDownItem" parent="#android:style/Widget.DropDownItem.Spinner">
<item name="android:textColor">#000000</item>
</style>
I am having a problems with my Transparent style inheriting the button style from the parent style (AppTheme). The button has a different style in the TransparentActivity theme.
Here are my styles, with a few items removed for simplicity.
<?xml version="1.0" encoding="utf-8"?>
<!-- Generated with http://android-holo-colors.com -->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="AppTheme" parent="#style/_AppTheme"/>
<style name="_AppTheme" parent="android:Theme.Light">
...
<item name="android:buttonStyle">#style/ButtonAppTheme</item>
...
</style>
<style name="TransparentActivity" parent="AppTheme">
<item name="android:windowBackground">#color/Trans60</item>
<item name="android:colorBackgroundCacheHint">#null</item>
<item name="android:textColor">#android:color/white</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowFullscreen">false</item>
</style>
</resources>
Try using #android:style/Theme.NoDisplay
So change :
<style name="TransparentActivity" parent="AppTheme">
<item name="android:windowBackground">#color/Trans60</item>
<item name="android:colorBackgroundCacheHint">#null</item>
<item name="android:textColor">#android:color/white</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowFullscreen">false</item>
</style>
To
<style name="TransparentActivity" parent="#android:style/Theme.NoDisplay">
<item name="android:buttonStyle">#style/ButtonAppTheme</item>
<item name="android:textColor">#android:color/white</item>
</style>
I try to change text color and size of my actionbar through the style resources:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="Theme.Example3" parent="#android:style/Theme.Holo.Light">
<item name="android:actionBarItemBackground">#drawable/selectable_background_example3</item>
<item name="android:popupMenuStyle">#style/PopupMenu.Example3</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.Example3</item>
<item name="android:actionBarTabStyle">#style/ActionBarTabStyle.Example3</item>
<item name="android:actionDropDownStyle">#style/DropDownNav.Example3</item>
<item name="android:actionBarStyle">#style/ActionBar.Solid.Example3</item>
<item name="android:actionModeBackground">#drawable/cab_background_top_example3</item>
<item name="android:actionModeSplitBackground">#drawable/cab_background_bottom_example3</item>
<item name="android:actionModeCloseButtonStyle">#style/ActionButton.CloseMode.Example3</item>
</style>
<style name="ActionBar.Solid.Example3" parent="#android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:background">#drawable/ab_solid_example3</item>
<item name="android:backgroundStacked">#drawable/ab_stacked_solid_example3</item>
<item name="android:backgroundSplit">#drawable/ab_bottom_solid_example3</item>
<item name="android:progressBarStyle">#style/ProgressBar.Example3</item>
</style>
<style name="Theme.Example3.ActionBar.Solid.Example3.TitleTextStyle" parent="#android:style/TextAppearance.Medium">
<item name="android:textSize">20sp</item>
<item name="android:textColor">#color/white</item>
</style>
<style name="ActionBar.Transparent.Example3" parent="#android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#drawable/ab_transparent_example3</item>
<item name="android:progressBarStyle">#style/ProgressBar.Example3</item>
</style>
<style name="PopupMenu.Example3" parent="#android:style/Widget.Holo.Light.ListPopupWindow">
<item name="android:popupBackground">#drawable/menu_dropdown_panel_example3</item>
</style>
<style name="DropDownListView.Example3" parent="#android:style/Widget.Holo.Light.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_example3</item>
</style>
<style name="ActionBarTabStyle.Example3" parent="#android:style/Widget.Holo.Light.ActionBar.TabView">
<item name="android:background">#drawable/tab_indicator_ab_example3</item>
</style>
<style name="DropDownNav.Example3" parent="#android:style/Widget.Holo.Light.Spinner">
<item name="android:background">#drawable/spinner_background_ab_example3</item>
<item name="android:popupBackground">#drawable/menu_dropdown_panel_example3</item>
<item name="android:dropDownSelector">#drawable/selectable_background_example3</item>
</style>
<style name="ProgressBar.Example3" parent="#android:style/Widget.Holo.Light.ProgressBar.Horizontal">
<item name="android:progressDrawable">#drawable/progress_horizontal_example3</item>
</style>
<style name="ActionButton.CloseMode.Example3" parent="#android:style/Widget.Holo.Light.ActionButton.CloseMode">
<item name="android:background">#drawable/btn_cab_done_example3</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="Theme.Example3.Widget" parent="#android:style/Theme.Holo">
<item name="android:popupMenuStyle">#style/PopupMenu.Example3</item>
<item name="android:dropDownListViewStyle">#style/DropDownListView.Example3</item>
</style>
</resources>
The above style.xml contains following code part, which should change text color and size, but it happens nothing on my actionbar:
<style name="Theme.Example3.ActionBar.Solid.Example3.TitleTextStyle" parent="#android:style/TextAppearance.Medium">
<item name="android:textSize">20sp</item>
<item name="android:textColor">#color/white</item>
</style>
What is wrong?
Thanks!!
<item name="android:titleTextStyle">#style/Theme.Example3.ActionBar.Solid.Example3.TitleTextStyle</item>
is missing in <style name="ActionBar.Solid.Example3">
The problem is that you need to link the third block of style from inside the second block of style:
<style name="ActionBar.Solid.Example3" parent="#android:style/Widget.Holo.Light.ActionBar.Solid">
<item name="android:background">#drawable/ab_solid_example3</item>
<item name="android:backgroundStacked">#drawable/ab_stacked_solid_example3</item>
<item name="android:backgroundSplit">#drawable/ab_bottom_solid_example3</item>
<item name="android:progressBarStyle">#style/ProgressBar.Example3</item>
<item name="android:titleTextStyle">#style/Theme.Example3.ActionBar.Solid.Example3.TitleTextStyle</item>
</style>