I want to use just the application logo instead of {application logo} + {title (text)} on android support action bar, app logo shows perfectly but app name shows up as title next to the logo.
I have tried tried following already:
getActionBar().setDisplayShowTitleEnabled(false);
This is not the best solution as title of the application is visible when application is loading up and is removed once app (or layout) is loaded completely.
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/darkblue</item>
<item name="android:textSize">0sp</item>
<item name="android:textColor">#00000000</item>
<!-- Support library compatibility -->
<item name="background">#color/darkblue</item>
</style>
This also doesn't have any effect on the application title on the support action bar.
Please suggest some alternatives, Thanks
Following changes to MyActionBar Style works perfectly!
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#color/darkblue</item>
<item name="android:displayOptions">showHome|useLogo</item>
<!-- Support library compatibility -->
<item name="background">#color/darkblue</item>
<item name="displayOptions">showHome|useLogo</item>
</style>
Related
In my setting page, a Settings.vue file I've my DatePicker
<template>
<Page>
<DatePicker/>
</Page>
</template>
I need to change the default style.
Note: actually I'm working specifically on Android, but please, answer keeping in mind I need the same colors on both Android and iOs; thanks,
I tried (in app.scss file
Datepicker {
color: white;
}
Without success, as you can see my android emulator is using a near-black color.
Following this guide, I changed colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ns_primary">#577eac</color>
<color name="ns_primaryDark">#577eac</color>
<color name="ns_accent">#ffffff</color>
<color name="ns_blue">#272734</color>
</resources>
Then I changed styles.xml
<style name="AppTheme" parent="AppThemeBase">
<item name="android:datePickerStyle">#style/SpinnerDatePicker</item>
</style>
<style name="SpinnerDatePicker" parent="android:Widget.Material.Light.DatePicker">
<item name="android:datePickerMode">spinner</item>
<item name="colorPrimary">#color/ns_primary</item>
<item name="colorPrimaryDark">#color/ns_primaryDark</item>
<item name="colorAccent">#color/ns_accent</item>
</style>
Note: I specified I want the spinner, but it's actually the default, I think.
I did a clean run
tns debug --hmr --clean
The problem: actually, the android DatePicker is still rendered using default colors, no my primary or accent colors as defined.
Similar question:
Nativescript Datepicker change text color - Uses the same solution, so it's useless for me because this solution doesn't works (for me, actually)
In my app I have an action bar . The problem is when I test my app in tab , there is a border under the action bar . (Screenshot attached below)
http://imgur.com/zOdCynv
But in any other phone there is no border (Screen shot attached below)
http://imgur.com/vs4klO3
Here is the code for my actionbar
<style name="ActionBar" parent="Widget.AppCompat.ActionBar.Solid">
<item name="android:background">#color/Navbar</item>
<item name="android:windowActionBarOverlay">false</item>
<item name="android:actionMenuTextColor">#color/white</item>
<item name="android:displayOptions">homeAsUp|showTitle</item>
<item name="displayOptions">homeAsUp|showTitle</item>
<item name="android:height">#dimen/abc_action_bar_default_height_material</item>
<item name="android:windowContentOverlay">#android:color/white</item>
<item name="icon">#android:color/transparent</item>
<item name="titleTextStyle">#style/MyTheme.ActionBar.TitleTextStyle</item>
<item name="elevation">0dp</item>
</style>
What is the reason of showing that border only in tab ? How can I remove it ?
Note: The OS of that tab is Android 4.4.2 KitKat
can you give a try with null and not white color.
<item name="android:windowContentOverlay">#null</item>
I have simple RatingBar in my app. and i set numStarts="5" but it show more then 5 star. when i set android:layout_width="match_parent" I tried to several tutorials but also did't work, as per doc numStarts for show number of starts but in my case it did't work. i go through doc and several tutorials but did't get any solution.
but i want to only 5 stars in rating bar.
my rating bar is given below.
<RatingBar
style="#style/customRatingBar"
android:id="#+id/course_rating_bar"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_marginRight="16dp"
android:layout_marginLeft="16dp"
android:numStars="5"
android:isIndicator="false"
android:stepSize="1.0"/>
This is my custom style
<style name="foodRatingBar" parent="#android:style/Widget.RatingBar">
<item name="android:progressDrawable">#drawable/ratingstars</item>
<item name="android:minHeight">22dip</item>
<item name="android:maxHeight">22dip</item>
</style>
......
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+android:id/background"
android:drawable="#drawable/star_empty" />
<item android:id="#+android:id/secondaryProgress"
android:drawable="#drawable/star_empty" />
<item android:id="#+android:id/progress"
android:drawable="#drawable/star" />
</layer-list>
You have to set android:layout_width="wrap_content" rather than "match_parent". Then you will get the 5 stars.
i have declared the logo in the manifest file like this :
android:allowBackup="true"
android:logo="#drawable/ic_launcher"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/CustomActionBarTheme"
and the custom theme is like this :
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:actionBarStyle">#style/MyActionBar</item>
<!-- Support library compatibility -->
<item name="actionBarStyle">#style/MyActionBar</item>
</style>
<!-- ActionBar styles -->
<style name="MyActionBar" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="android:background">#drawable/actionbar_background</item>
<item name="android:icon">#drawable/ic_launcher</item>
<!-- Support library compatibility -->
<item name="background">#drawable/actionbar_background</item>
<item name="icon">#drawable/ic_launcher</item>
</style>
</resources>
but the logo is not showing in the actionbar, i have tried many ways but not working, can anybody pls help me ?
With the new appcompat 21, the pattern is changed.
The Action Bar follows the material design guidelines and uses a Toolbar.
As you can read here:
The use of application icon plus title as a standard layout is
discouraged on API 21 devices and newer.
If you would like an application icon, you can use the method setLogo().
You should read this official post.
I'm changing the UI of my app to green colors. In the ActionBar, I use a ShareActionProvider to share data to other users, but this menu item doesn't get the same color as the other menu items. However, its dropdown listview has the correct colors.
I'm running my app in GingerBread, so when I press menu key, a menu item appears but it also has the wrong colors.
I have used Android Action Bar Style Generator, but there is something I'm missing. This is my code in /res/values:
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="actionBarItemBackground">#drawable/selectable_background_newtheme</item>
<item name="actionBarStyle">#style/ActionBar.Solid.NewTheme</item>
<item name="popupMenuStyle">#style/PopupMenu.NewTheme</item>
<item name="dropDownListViewStyle">#style/DropDownListView.NewTheme</item>
<item name="actionDropDownStyle">#style/DropDownNav.NewTheme</item>
<!-- Light.DarkActionBar specific -->
<item name="actionBarWidgetTheme">#style/NewTheme.Widget</item>
</style>
<!-- ActionBar style -->
<style name="ActionBar.Solid.NewTheme" parent="#style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
<item name="background">#drawable/action_bar_gradient</item>
</style>
<style name="PopupMenu.NewTheme" parent="#style/Widget.AppCompat.PopupMenu">
<item name="android:popupBackground">#drawable/background_gradient</item>
</style>
<style name="DropDownListView.NewTheme" parent="#style/Widget.AppCompat.ListView.DropDown">
<item name="android:listSelector">#drawable/selectable_background_newtheme</item>
</style>
<style name="DropDownNav.NewTheme" parent="#style/Widget.AppCompat.Spinner.DropDown.ActionBar">
<item name="android:background">#drawable/spinner_background_ab_newtheme</item>
<item name="android:dropDownSelector">#drawable/selectable_background_newtheme</item>
</style>
<!-- this style is only referenced in a Light.DarkActionBar based theme -->
<style name="NewTheme.Widget" parent="#style/Theme.AppCompat">
<item name="popupMenuStyle">#style/PopupMenu.NewTheme</item>
<item name="dropDownListViewStyle">#style/DropDownListView.NewTheme</item>
</style>
Is there any missing item? Thanks in advance
I finally got it working myself. I had to add:
<item name="android:listChoiceBackgroundIndicator">#drawable/selectable_background_realestate</item>
in *themes_base.xml* in values-v14 and
<item name="listChoiceBackgroundIndicator">#drawable/selectable_background_realestate</item>
in themes_base.xml in values for the correct highlight color when pressing a list item.
I also had to change actionBarItemBackground in themes_base.xml (values and values-v14) to reference my drawable so that the share icon would get the same highlight.
Finally to get the right color of the dropdown menu item I had to change android:popupBackground to #drawable/menu_dropdown_panel_realestate in styles_base.xml (values and values-v14) for Widget.AppCompat.Base.ListPopupWindow
The drawables I referenced in my answer were generated using Android Asset Studio for AppCompat
I think I can help you solve your Gingerbread problem.
That menu is called a "panel" in the AppCompat style & theme .XML files.
So to override it with your own selector colour, this is what I suggest:
In your custom theme, CustomActionBarTheme, add this line:
<item name="panelMenuListTheme">#style/Theme.NewTheme.CompactMenu</item>
And add these two styles:
<style name="Theme.NewTheme.CompactMenu" parent="#style/Theme.AppCompat.CompactMenu">
<item name="android:listViewStyle">#style/myCustomMenuStyle</item>
</style>
and
<style name="myCustomMenuStyle" parent="#style/Widget.AppCompat.ListView.Menu">
<item name="android:listSelector">#drawable/newtheme_list_selector_holo_light</item>
</style>
note: the #drawable/newtheme_list_selector_holo_light is an xml resource that I got from the Android Holo Colors Generator.
I suggest you use the website, by the way, you only need the resources of the "List Selector" in this case, and grab the following resources from the ZIP file that it outputs, and put them in your drawable folders.
Specifically:
newtheme_list_selector_holo_light.xml > in res/drawable
newtheme_list_selector_background_transition_holo_light.xml > in res/drawable
And the mdpi, hdpi, xdpi and xxdpi of the following .9.png resources:
newtheme_list_selector_disabled_holo_light.9.png
newtheme_list_pressed_holo_light.9.png (similar to the png Action Bar Generator created)
newtheme_list_longpressed_holo.9.png
newtheme_list_focused_holo.9.png (similar to the png Action Bar Generator created)
A bit later however it might help. In GingerBread, when you press menu key, the menu item which appears at the bottom can be customize by the following attribute itemBackground:
<style name="CustomActionBarTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:itemBackground">#drawable/selectable_background_newtheme</item>
</style>
Then, apparently to customize the ShareActionProvider item pressed, you need this attribute:
<style name="CustomActionBarTheme" parent="#style/Theme.AppCompat.Light.DarkActionBar">
<item name="android:selectableItemBackground">#drawable/selectable_background_newtheme</item>
</style>