add margin on popup menu items - android

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>

Related

How to custom the CollapsingToolbarLayout title animation

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));

Avoid using an item in style

I have a style for a button bar. some thing like this:
<style name="Register.LayoutButtons">
<item name="android:orientation">horizontal</item>
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1.0</item>
<item name="android:layout_marginTop">16dp</item>
<item name="android:background">#color/white</item>
</style>
Its OK for most of usage but in 1 place i don't need the layout_marginTop.
How can i cancel its effect without using a new style?
In the resource where you set the style of an item, you can also set layout_marginTop="0dp". Or if you do it dynamically there should be a setter - for example setMargins(left, top, right, bottom).

How to delete overlay in an Android modified Holo button?

I have this style for Buttons in my Android app, but I don't want that little shadow.
<style name="AppTheme.Button.Primary" parent="#android:style/Widget.Holo.Button">
<item name="android:background">#color/primary_dark</item>
<item name="android:textColor">#color/primary_light</item>
<item name="android:gravity">center</item>
<item name="android:textSize">15sp</item>
<item name="android:layout_width">20dp</item>
<item name="android:layout_height">20dp</item>
<item name="android:layout_centerHorizontal">true</item>
</style>
The button looks like this:
Button image
Which item have to add in order to delete the overlay?
Thanks a lot!
Solved, I was applying the Material Light theme, so I changed it to my style and when I run the app no overlay is showed. Thanks.

Change toggle button text color

I am using this library for creating switch toggle button.
I am wondering how could I change the text color which stayed behind. For more clear there is green switcher, the text is white, how could I change gray text which is not selectable. I couldn't find how to do this.
here is the style of mySwitch
<style name="mySwitchStyle">
<item name="switchTextAppearanceAttrib">#style/mySwitchTextAppearance</item>
<item name="pushStyle">false</item>
<item name="textOnThumb">true</item>
<item name="thumbExtraMovement">0dp</item>
<item name="thumbTextPadding">6dp</item>
<item name="trackTextPadding">6dp</item>
<item name="switchMinWidth">300dp</item>
<item name="switchMinHeight">36dp</item>
<item name="switchPadding">6dp</item>
</style>
<style name="mySwitchTextAppearance">
<item name="textColor">#color/white</item>
<item name="textSize">28sp</item>
<item name="textStyle">normal</item>
</style>
Use the function setTextColor(int), Documentation Link here

Android ActionBar Sherlock - Remove divider between tabs altogether

I'm trying to remove the divider between the tabs in an ActionBar (actually an ActionBarSherlock) altogether; i.e. no image between tabs and no gap between the tabs either (I'm using a tiled image background in the tabs). Ideally, I'd like the dividers removed in the XML, rather than in code.
I've tried a few approaches, but nothing seems to be working, such as:
<style name="Theme.MyTheme.ActionBarTab" parent="Widget.Sherlock.ActionBar.TabBar">
<item name="android:divider">#null</item>
<item name="divider">#null</item>
<item name="actionBarDivider">#drawable/empty</item>
<item name="android:showDividers">none</item>
</style>
Turns out I was setting the wrong style. The android:showDividers attribute does work, but when it's applied to the style that inherits from the Widget.Sherlock.ActionBar.TabBar style. So the relevant bits of XML are:
<style name="Theme.Client" parent="Theme.Sherlock.Light.DarkActionBar">
<item name="android:actionBarTabBarStyle">#style/Theme.Client.ActionBarTabBar</item>
<item name="actionBarTabBarStyle">#style/Theme.Client.ActionBarTabBar</item>
</style>
<style name="Theme.Client.ActionBarTabBar" parent="Widget.Sherlock.ActionBar.TabBar">
<item name="android:background">#drawable/tab_bar_bg_tiled</item>
<item name="background">#drawable/tab_bar_bg_tiled</item>
<item name="android:showDividers">none</item>
</style>

Categories

Resources