I can't seem to determine why my overflow button is not the three-dot icon. It uses what seems to be a dropdown button (down arrow icon).
How come most of the applications I found uses the three-dot icon for the overflow. Here's my styles.xml so far.
<!-- 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/CncaActionBar</item>
</style>
<style name="FullscreenTheme" parent="android:style/Theme">
<item name="android:actionBarStyle">#style/CncaActionBar</item>
<item name="android:actionBarTabStyle">#style/CncaActionBarTab</item>
<item name="android:actionBarTabTextStyle">#style/CncaActionBarTabText</item>
<item name="android:windowBackground">#null</item>
<item name="buttonBarStyle">?android:attr/buttonBarStyle</item>
<item name="buttonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
</style>
<style name="CncaActionBarTab" parent="#android:Widget.Holo.ActionBar.TabView">
<item name="android:background">#drawable/bg_tab</item>
</style>
<style name="CncaActionBarTabText" parent="#android:style/TextAppearance.Holo">
<item name="android:textColor">#android:color/white</item>
<item name="android:textAllCaps">true</item>
</style>
I've figured it out. I just needed to use Theme.Holo styling. This used the three-dot icon.
Related
I've been trying real hard to theme SearchView. My min API is sdk 21 too, so I should be able to use the new styling options.
Specifically, I want the in-app-bar text field that appears when I click on the search icon to be theme-able. I want to ultimately make the background white, and the text/cursor either blue or black.
Here is my styles.xml. The last theme is the new SearchTheme I'm working on. The actual values don't matter, they're garbage values I threw in just trying to make a change happen.
<resources>
<!-- 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>
<item name="android:windowBackground">#android:color/white</item>
<item name="android:searchViewStyle">#style/AppTheme.SearchTheme</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.PreferencesTheme" parent="AppTheme">
<item name="android:windowBackground">#android:color/white</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:windowBackground">#android:color/white</item>
<item name="android:searchViewStyle">#style/AppTheme.SearchTheme</item>
</style>
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light">
<item name="android:windowBackground">#android:color/white</item>
<item name="android:searchViewStyle">#style/AppTheme.SearchTheme</item>
</style>
<style name="AppTheme.SearchTheme" parent="Theme.AppCompat.Light">
<item name="android:closeIcon">#drawable/contacts5icon</item>
<item name="android:voiceIcon">#drawable/contacts5icon</item>
<item name="android:queryBackground">#android:color/black</item>
<item name="android:windowBackground">#android:color/white</item>
</style>
</resources>
I've assigned the AppTheme.SearchTheme to the other main themes that I'm using in my layout. But nothing I do seems to have any effect. The values don't seem to change.
I haven't really messed with Android theming before, so I'm a bit lost.
This should help you get on the right track, per Chris Banes' walk-through for using material design on pre-lollipop androids. For you, in a nutshell: set item property searchViewStyle under your main style with a Widget.AppCompat.SearchView style extension.
You can use the queryBackground item property for altering the text field's background. Other properties are detailed below.
<style name=”Theme.MyTheme” parent=”Theme.AppCompat”>
<item name=”searchViewStyle”>#style/MySearchViewStyle</item>
</style>
<style name=”MySearchViewStyle” parent=”Widget.AppCompat.SearchView”>
<!-- Background for the search query section (e.g. EditText) -->
<item name="queryBackground">...</item>
<!-- Background for the actions section (e.g. voice, submit) -->
<item name="submitBackground">...</item>
<!-- Close button icon -->
<item name="closeIcon">...</item>
<!-- Search button icon -->
<item name="searchIcon">...</item>
<!-- Go/commit button icon -->
<item name="goIcon">...</item>
<!-- Voice search button icon -->
<item name="voiceIcon">...</item>
<!-- Commit icon shown in the query suggestion row -->
<item name="commitIcon">...</item>
<!-- Layout for query suggestion rows -->
<item name="suggestionRowLayout">...</item>
</style>
more here
I'm working on a application in which I am having Tab Bars. I am assigning a custom theme to my tabs using styles.xml present in values-v23 folder. But the thing is that I am not able to achieve my custom theme every time I'm launching the application. I can't understand where is the problem. I am sharing my style.xml file here to make you understand this better.
styles.xml
<style name="AppBaseTheme" parent="Theme.AppCompat.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>
<style name="AppThemeWhite" parent="AppBaseTheme">
<item name="android:windowIsTranslucent">false</item>
<item name="android:windowBackground">#color/white</item>
<item name="android:textColor">#color/black</item>
<item name="android:editTextStyle">#style/BlackEditText</item>
<item name="android:actionBarTabTextStyle">#style/CustomActionBarTabs_TextColor</item>
<item name="android:actionBarTabStyle">#style/CustomActionBarTabs</item>
<item name="android:actionBarTabBarStyle">#style/CustomActionBarTabBar</item>
</style>
<!-- action bar tab styles -->
<style name="CustomActionBarTabs_TextColor" parent="#style/Widget.AppCompat.ActionBar.TabText">
<item name="android:textColor">#666666</item>
<item name="android:textSize">14sp</item>
<item name="android:typeface">sans</item>
</style>
Here I'm trying to change the text color of Tab titles by using the #style/CustomActionBarTabs_TextColor property but nothing is happening. Can someone please help to solve this one.
Any help would be appreciable.
Thanks.
you can apply following style to your tab layout
<style name="MyCustomTabLayout" parent="Widget.Design.TabLayout">
<item name="tabIndicatorColor">#color/indicatorcolor</item>
<item name="tabIndicatorHeight">4dp</item>
<item name="tabTextAppearance">#style/MyCustomTabTextAppearance</item>
<item name="tabSelectedTextColor">#color/seltextcolor</item>
</style>
<style name="MyCustomTabTextAppearance" parent="TextAppearance.Design.Tab">
<item name="android:textSize">14sp</item>
<item name="android:textColor">#000000</item>
<item name="textAllCaps">true</item>
</style>
I dont know why but because of some reasons my overflow button in my actionbar is transparent.Are there any reasons for that and how can I fix it ? Whats the default style for it ? I dont want to download material icons from Google because I think they should be already in it.
My AppTheme style :
<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="android:windowFullscreen">true</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:actionModeBackground">#color/colorPrimary</item>
<item name="colorAccent">#color/colorPrimary</item>
I want to change text size of action bar item.
here is my style.xml:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionMenuTextAppearance">#style/menu_text</item>
<!-- Customize your theme here. -->
</style>
<style name="menu_text">
<item name="android:textSize">20sp</item>
</style>
this works on android 5 but on android 4 the text size is default and does not change.
in my Project folder res/styles AppTheme has a comment as below,
<!-- All customizations that are NOT specific to a particular API-level can go here. -->
So you can do it with your app Theme. I have done it via below code,
<style name="Theme.YourTheme" parent="android:style/Theme">
<item name="android:actionBarStyle">#style/Theme.YourTheme.Styled.ActionBar</item>
</style>
<style name="Theme.YourTheme.Styled.ActionBar">
<item name="android:titleTextStyle">#style/Theme.Viadeo.Styled.YourTheme.TitleTextStyle</item>
</style>
<style name="Theme.YourTheme.Styled.ActionBar.TitleTextStyle" parent="#android:style/Widget.TextView">
<item name="android:textSize">12dp</item>
</style>
Hope this helps you.
Some users of my application are experiencing a weird problem when using my application in landscape mode. I am using actionbarsherlock and have set the navigation mode to tabs (using ActionBar.NAVIGATION_MODE_TABS).
Some users are finding when launching the app in portrait and then rotating the device the actionbar shows a spinner list rather than the tabs (which apparently is expected behaviour). The problem is the spinner is not selectable.
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
bar.addTab(bar.newTab().setText("Deals").setTabListener(this),false);
bar.addTab(bar.newTab().setText("Vouchers").setTabListener(this),false);
bar.addTab(bar.newTab().setText("Freebies").setTabListener(this),false);
EDIT
Just discovered it is related to my custom theme. Changing the theme to the default Sherlock.Light makes the spinner selectable. The custom theme is shown below.
<!-- Variation on the Holo Light theme that styles the Action Bar -->
<style name="DealPadTheme" parent="Theme.Sherlock.Light.ForceOverflow">
<item name="android:selectableItemBackground">#drawable/ad_selectable_background</item>
<item name="actionBarItemBackground">#drawable/ad_selectable_background</item>
<item name="android:actionBarTabStyle">#style/MyActionBarTabStyle</item>
<item name="actionBarTabStyle">#style/MyActionBarTabStyle</item>
<item name="android:actionBarStyle">#style/Widget.ActionBar</item>
<item name="actionBarStyle">#style/Widget.ActionBar</item>
<item name="android:dropDownListViewStyle">#style/MyDropDownListView</item>
<item name="dropDownListViewStyle">#style/MyDropDownListView</item>
<item name="android:actionDropDownStyle">#style/MySpinner</item>
<item name="actionDropDownStyle">#style/MySpinner</item>
<item name="android:activatedBackgroundIndicator">#drawable/selectable_list_item</item>
<item name="activatedBackgroundIndicator">#drawable/selectable_list_item</item>
<item name="android:listSelector">#style/MyListView</item>
</style>
<style name="MyListView" parent="#android:style/Widget.ListView">
<item name="android:listSelector">#drawable/list_arrow_selected_holo</item>
</style>
<!-- style for the tabs -->
<style name="MyActionBarTabStyle">
<item name="android:background">#drawable/actionbar_tab_bg</item>
<item name="android:paddingLeft">16dp</item>
<item name="android:paddingRight">16dp</item>
<item name="android:gravity">center_horizontal</item>
</style>
<style name="Widget.ActionBar" parent="Widget.Sherlock.Light.ActionBar">
<item name="android:displayOptions">showHome|useLogo|showCustom</item>
<!-- removed as not all activites need it <item name="android:customNavigationLayout">#layout/custom_action_bar</item> -->
<item name="android:background">#drawable/ad_tab_unselected_holo</item>
<item name="background">#drawable/ad_tab_unselected_holo</item>
<item name="android:titleTextStyle">#style/Widget.ActionBar.Title</item>
<item name="titleTextStyle">#style/Widget.ActionBar.Title</item>
</style>
<style name="Widget.ActionBar.Title" parent="Widget">
<item name="android:textSize">12sp</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<!-- style the items within the overflow menu -->
<style name="MyDropDownListView" parent="Widget.Sherlock.Light.ListView.DropDown">
<item name="android:listSelector">#drawable/ad_selectable_background</item>
</style>
<!-- style the items within the overflow menu -->
<style name="MySpinner">
<item name="android:background">#drawable/spinner_background</item>
</style>
Wow so it turns out it was as I hadn't stated the parent when themeing ActionDropDownStyle.
It's only when I created a new project was that I discovered it was related to the theme.I presumed it was an issue relating to the code or handling orientation change incorrectly.
Doing the following sorts it:
<!-- style the items within the overflow menu -->
<style name="MySpinner" parent="Widget.Sherlock.Light.Spinner.DropDown.ActionBar" >
<item name="android:background">#drawable/spinner_background</item>
</style>
The only issue now is some of the spinner items are cut off and replaced with ... Although I think this is a known bug.