Actually I dont need the title alpha animation while the CollapsingToolbarLayout is closing or opening. Just look like the picture
I want that when it is closed the title shows on the Toolbar, and wht it is opened it will disappear, I have search google for a day, but still no answer.
Need some help! is't any ways to solve my probleam? Thanks!
I have removed the animation of title by add app:titleEnabled="false" while I don't know how to customer the animation.
Otherwise, thanks.
did you try playing with the textAppearance of the collapseToolBar
collapsebar.setExpandedTitleTextAppearance(R.style.ExpandedAppBar);
collapsebar.setCollapsedTitleTextAppearance(R.style.CollapsedAppBar);
collapsebar.setExpandedTitleTextAppearance(R.style.ExpandedAppBarPlus1);
collapsebar.setCollapsedTitleTextAppearance(R.style.CollapsedAppBarPlus1);
File style.xml content :
28sp
#android:color/transparent
bold
<style name="CollapsedAppBar" parent="#android:style/TextAppearance.Medium">
<item name="android:textSize">24sp</item>
<item name="android:textColor">#android:color/transparent</item>
<item name="android:textStyle">normal</item>
</style>
<style name="ExpandedAppBarPlus1" parent="#android:style/TextAppearance.Medium">
<item name="android:textSize">20sp</item>
<item name="android:textColor">#android:color/transparent</item>
<item name="android:textStyle">bold</item>
</style>
<style name="CollapsedAppBarPlus1" parent="#android:style/TextAppearance.Medium">
<item name="android:textSize">18sp</item>
<item name="android:textColor">#android:color/white</item>
<item name="android:textStyle">normal</item>
</style>
the title will be white when bar collapsed (showed)
the title will be transparent when bar expanded (hided)
hope this was helpfull
good luck !!
Only this command will do if using CollapsingToolbarLayout.
collapsingToolbarLayout.setExpandedTitleColor(getResources().getColor(android.R.color.transparent));
Related
I'm trying to style the datepicker dialog. So far I managed to change the background and button color. But as you can see in the image below, the title is sort of 'pillar-boxed'.
My datepicker dialog with the dark boxes left and right of the title:
My xml code so far (values/styles.xml)
<style name="PickerDialogTheme_dark" parent="Theme.AppCompat.Dialog">
<item name="android:background">#color/colorBackground_bgreen</item>
<item name="android:buttonBarButtonStyle">#style/ButtonColor</item>
</style>
<style name="ButtonColor">
<item name="android:background">#color/colorBackground_bgreen</item>
</style>
In java it is just a regular datepicker dialog constructor with the theme set to PickerDialogTheme_dark and I'm trying to get this to work on pre Lollipop versions.
So hope you guys know how to get rid of this pillar-boxed title. If possible without using fragments and all in xml would be favourable :)
Fixed it finally after searching some more on the internet!
How my final xml code looks now:
<style name="PickerDialogTheme_dark" parent="Theme.AppCompat.Dialog">
<item name="android:gravity">center</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:alertDialogStyle">#style/DialogBackground_dark</item>
<item name="android:windowMinWidthMajor">#android:dimen/dialog_min_width_major</item>
<item name="android:windowMinWidthMinor">#android:dimen/dialog_min_width_minor</item>
</style>
<style name="DialogBackground_dark">
<item name="android:topDark">#color/colorAccent_bgreen</item>
<item name="android:centerDark">#color/colorAccent_bgreen</item>
<item name="android:bottomDark">#color/colorAccent_bgreen</item>
<item name="android:bottomMedium">#color/colorAccent_bgreen</item>
</style>
This is how it looks like now
I am using the default pop menu with custom font(by overriding the default font), but it seems like the items have a little margin from bottom:
I think this problem is because of my font, but I like this font and I don't want to change it.
Do you have any suggestions about how can I add some margin from top on menu items?
<style name="ucrop_popup_menu">
<item name="android:textColor">#color/black</item>
<item name="android:textSize">#dimen/_11sdp</item>
<item name="android:fontFamily">#font/graphit_regular</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:popupBackground">#drawable/match_radius</item>
<item name="android:dropDownHorizontalOffset">-16dp</item>
<item name="android:dropDownVerticalOffset">#dimen/_16sdp</item>
</style>
I want to change the background of alert dialog title in theme.
I do following changes in theme:
<style name="NgTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:dialogTheme">#style/NgDialogTheme</item>
<item name="android:alertDialogTheme">#style/NgAlertDialogTheme</item>
</style>
<style name="NgDialogTheme" parent="#android:style/Theme.Holo.Light.Dialog">
<item name="android:background">#android:color/transparent</item>
<item name="android:windowTitleStyle">#style/NgWindowTitleStyle</item>
</style>
<style name="NgAlertDialogTheme" parent="#style/NgDialogTheme">
</style>
<style name="NgWindowTitleStyle" parent="android:TextAppearance.Holo.DialogWindowTitle">
<item name="android:background">#318d99</item>
<item name="android:textColor">#fff</item>
</style>
I expected that background of title becomes #318d99. But only background of text is #318d99:
How can I change white frame around the title to #318d99?
Also the frame around the dialog isn't transparent. How can I fix it?
There are some valuable posts about this already and very closely related to your question.
Google's post on customizing this is possibly worth looking at first:
https://sites.google.com/site/androidhowto/how-to-1/customize-alertdialog-theme
Take a look at this blog post:
http://blog.supenta.com/2014/07/02/how-to-style-alertdialogs-like-a-pro/
Specifically, go to Part 5: Styling the Background.
To summarize, they suggest that you will probably have to
Stop inheriting from Holo
Give your main theme an alertDialogStyle
Then create a style with the following attributes, which you can get a reference to here: http://developer.android.com/reference/android/R.styleable.html#AlertDialog
You'll want to create a new style that inherits from the default alertdialog theme (this is discussed in both posts I mentioned above):
<style name="CustomDialogTheme" parent="#android:style/Theme.Dialog">
<item name="android:bottomBright">#color/white</item>
<item name="android:bottomDark">#color/white</item>
<item name="android:bottomMedium">#color/white</item>
<item name="android:centerBright">#color/white</item>
<item name="android:centerDark">#color/white</item>
<item name="android:centerMedium">#color/white</item>
<item name="android:fullBright">#color/orange</item>
<item name="android:fullDark">#color/orange</item>
<item name="android:topBright">#color/blue</item>
<item name="android:topDark">#color/blue</item>
</style>
I want to customize back and clear icon in SearchView when it collapses. My requirement is to change the color to white but now it is black.(Please refer the image shared below). I am looking to fix this issue for a couple of days, but none of the solution which I tried had not worked out. I tried few of the solutions suggested from SO like as follows:
Solution 1:
<style name="AppTheme" parent="#style/Theme.Base.AppCompat.Light.DarkActionBar">
<item name="actionBarWidgetTheme">#style/YourActionBarWidget</item>
</style>
<style name="YourActionBarWidget" parent="#style/Theme.AppCompat">
<item name="searchViewCloseIcon">#drawable/xxx</item>
</style>
Solution 2:
final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
upArrow.setColorFilter(getResources().getColor(R.color.WHITE), PorterDuff.Mode.SRC_ATOP);
getSupportActionBar().setHomeAsUpIndicator(upArrow);
My project styles.xml
<style name="ToolBarTheme" parent="#style/Theme.AppCompat.Light">
<item name="colorPrimary">#color/blue</item>
<item name="colorPrimaryDark">#color/blue</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="drawerArrowStyle">#style/DrawerArrowStyle</item>
<item name="android:itemTextAppearance">#style/myCustomMenuTextApearance</item>
<item name="android:actionMenuTextColor">#color/white</item>
<item name="actionMenuTextColor">#color/white</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">#color/white</item>
<item name="gapBetweenBars">2.5dip</item>
<item name="thickness">2dp</item>
</style>
Screenshot of My exact problem:
Kindly please help me to resolve my issue. Any kind of solutions and suggestions would be much helpful for me. Thanks for your support.
if you are searching for white icons on toolbar
add these on your toolbar tag
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
I am assuming you are using this as your base application theme.
<style name="AppTheme" parent="#style/Theme.Base.AppCompat.Light.DarkActionBar">
Just change it to
<style name="AppTheme" parent="#style/Theme.AppCompat.NoActionBar">
Worked for me if you only want to change the back and X icon to white.
1: To change back button icon, add
app:collapseIcon="#drawable/back_arrow"
in android.support.v7.widget.Toolbar
2: To change clear button icon, add
ImageView searchClose = searchView.findViewById(android.support.v7.appcompat.R.id.search_close_btn);
searchClose.setImageResource(R.drawable.close);
in onCreateOptionsMenu
Many of my questions about "styling" actionbar tabs were answered by adamp in this thread on tab style, but I am still struggling with my arriving at the desired presentation.
Specifically, I am attempting to do what adamp suggested in the following fragment from my styles.xml file, but, I cannot get the inherited (Widget.holo.actionbar) feature of a light blue line to appear under the selected tab nor is there any indication of selection:
<style name="MyTheme" parent="android:style/Theme.Holo">
<item name="android:actionBarStyle">#style/CustomActionBar</item>
</style>
<style name="CustomActionBar" parent="android:style/Widget.Holo.ActionBar">
<item name="android:actionBarTabTextStyle">#style/customActionBarTabTextStyle</item>
<item name="android:actionBarTabStyle">#style/customActionBarTabStyle</item>
<item name="android:actionBarTabBarStyle">#style/customActionBarTabBarStyle</item>
</style>
<style name="customActionBarTabTextStyle" parent="#style/CustomActionBar">
<item name="android:textColor">#2966c2</item>
<item name="android:textSize">20sp</item>
<item name="android:typeface">sans</item>
</style>
<style name="customActionBarTabStyle" parent="#style/CustomActionBar">
<!-- <item name="android:background">#drawable/actionbar_tab_bg</item> -->
<item name="android:paddingLeft">20dp</item>
<item name="android:paddingRight">20dp</item>
</style>
<style name="customActionBarTabBarStyle" parent="#style/CustomActionBar">
<item name="android:paddingLeft">240dp</item>
</style>
Can someone explain why the thin blue line selection behavior of the Honeycomb Gallery Sample App does not work for me?
New insight since this was written: the problem here, I think, is that the style I have created to overide ActionBarTabStyle is entirely bogus:
<style name="customActionBarTabStyle" parent="#style/CustomActionBar">
<item name="android:paddingLeft">20dp</item>
<item name="android:paddingRight">20dp</item>
</style>
I need to specify the correct parent of this style per "Theme.holo"....how can one find where the default style is so it can be specified as a parent?
Thanks
To specify the correct parents for actionbar style in API 11, Check doc here:
https://developer.android.com/training/basics/actionbar/styling.html