Style Top & Bottom Part of Divider for Tab Widget - android

I have a TabWidget and I'm trying to style the divider. (See image above)
I set the Divider Drawable of the TabWidget but the top & bottom part is unchanged. I can't figure out how to style it.

All you need to do is set the dividerPadding attribute to 0dp in your TabWidget.
android:dividerPadding="0dp"
Also, maybe consider switching to ActionBar.Tabs instead, just considering TabWidget is deprecated.

It seems that Holo theme has default 16 pixels dividerPadding for each TabWidget.
I try to set it to zero in the XML but it is not working.
Fortunately, it works for me to set it dynamically as below
myTabHost.getTabWidget().setDividerPadding(0);
Note: I am using android.support.v4.app.FragmentTabHost

are you talking about grey bars on the top and the bottom of the divider? use fill_parent for the drawable's height and width if that is the case!

Related

Removing icon from BottomNavigationView

I want my menu items on the BottomNavigationBar to have text-only labels with no icon. Unfortunately, it looks like design_bottom_navigation_item.xml always has a 24x24dp space reserved for the icon, with no publicly-exposed way to set it to gone. And even after getting past that, the label layout is set to a layout_gravity of bottom|center_horizontal, and it doesn't look like there's a way to programatically set layout_gravity to centered.
What is the fastest, easiest way to achieve the goal of a text-only menu item on the bottom nav bar? I'm thinking I can do this by creating a custom version of the item layout, then subclassing BottomNavigationItemView, BottomNavigationMenuView, and BottomNavigationView to specify that custom layout... but that seems like an awful lot of work for one little change. Am I missing something simpler?
dont put iandroid:icon property to your item
Just use the code below. I tried hard to do this easy way but failed.Then I made an alternative. Just use transparent color instead of icon drawble
<item
android:icon="#android:color/transparent"
android:id="#+id/navigation_id"
android:title="title" />
Add this in your dimens file. Then you can add padding according to your navigation view size.
<dimen name="design_bottom_navigation_height"tools:override="true">30dp</dimen>

RTL properties with padding attribute android

I am working on an android application and provided support for RTL feature in my application.
Now when I define any marginLeft Property, I define the same marginStart property also on that view to have the same with RTL languages.
If I define margin attribute (margin attribute contains : marginTop, marginLeft, marginRight and marginBottom), so this attribute already contains Left and Right margins, so should I need to define marginStart and marginEnd properties as well on this view, or it'll be automatically work on that.
Please help if anyone have any idea about this.
In places you use both marginLeft and marginRight you don't need to add marginStart/marginEnd.
You should use Start/End when you define one side only.
If your app only supports API ≥ 17, replace all the layout_marginLeft/layout_marginReft/paddingLeft/paddingRight or any other Left and Right layout property with Start and End equivalent. For example android:paddingLeft will be replaced with android:paddingStart.
If your app supports API<17 then instead of replacing the Left and Right layout properties, add their Start and End layout property equivalent alongside.

how to make android seekbar full width in api 17 or above?

I want to make seekbar full width with no padding.
I've seen this answer
How to make SeekBar take up full width of parent
but in api 17 and above it doesn't work. there is a padding in left and right of seekbar. how do i remove this padding?
I just set padding at run time and it's OK now!
musicSeekbar.setPadding(0,0,0,0);
You can make it work using XML (API 17+):
android:paddingStart="0dp"
android:paddingEnd="0dp"
you can use a parent layout before your seekbar's layout and put your seekbar layout in another one so that you can fill_parent

TextView with custom font isn't centered vertically

I need to use a custom font (VAG Rounded, probably not relevant) but the font changes how my TextViews react.
In the image below, you can see the two textviews with a black background. The left one use the custom font, the right one the default system font (Roboto ?). Both of them have the same xml properties and size, but the padding is not the same and more important, the left one isn't centered vartically !
How can I make the TextView draw its content well centered ?
You can try to remove your customs font padding from your text style (styles.xml):
<item name="android:includeFontPadding">false</item>
If this still doesn't work, i would set a general padding in your styles xml.
I think that you have to set android:layout_height="match_parent" and then also android:gravity="center"
then if you post also your source code we can give you more information
I could not change the font, and I wasn't going to edit each character using an editor (I don't even know what I should have done to fix it).
Si I ended up measure the difference with the default font and I added 0.15f * fontSize in the padding top...

How to set margin for all TextView using styles.xml

I've read from another post that it's possible to set attributes like color to every TextView in an application: Setting global styles for Views in Android. However, I can't set layout_margin nor layout_height and layout_width attribute using that method to any textView, using "android:textviewStyle". On the other hand, if I use the style attribute and reference it to a style with all the attributes above, it works. Is there a way that you can use global styles and still set margin?
Thank you in advance
You can set padding instead of margin and you will have the same result.

Categories

Resources