How to change the gap between icon and text? - android

Picture
To see the picture , please click the link at the top.
Here is a ViewPager + TabLayout。
I use the following code to create the tablayout.
firstTab.setIcon(R.drawable.tab_home_green).setText("HOME");
secondTab.setIcon(R.drawable.tab_explore_grey).setText("EXPLORE");
thirdTab.setIcon(R.drawable.tab_me_grey).setText("MIME");
Now the gap between icon and title is fixed, In the source the gap is private. I want to know how to change the gap value?
How to change the padding of each Tab?

Create and inflate a custom tab's layout.

You can also use view tag in xml for the space between the icon

Related

BottomNavigationView with text only

Is it possible to remove icon padding and center text vertically in BottomNavigationView from material library (or at least change the height of navbar without title cutting)?
Want to achieve the result like this.
Thanks!
Use tab layout instead you can easily achieve that. Here is the link https://material.io/components/tabs

How do I implement a custom bottomnavigation like this

I need to implement a custom bottomnavigation like in the image. My peculiar issue is that when a menu item from the bottomNav is clicked the bottomnav has to reposition the text above and add an image of a dot below it like as shown in the image.
This means that small solutions to selected state like using a custom selector cannot solve this.
Is there a way to inflate a selected layout to show how the bottomNav should look when selected? What methods or other ways do you suggest I tackle this issue?
Try This Git library It's not 100% same as want, but good
https://github.com/iammert/ReadableBottomBar
Ah! Totally forgot to answer this after I solved it.
I was initially showing an Icon and label combination in the bottomnavigation. I was looking for a way to hide the icon on click and show a dot on the bottom which was the wrong way to go and would be complex.
I ended up adding the icon and label as a group drawable vector instead of individually. So for each bottomnavigation option, I had a drawable selector xml with state for selected and unselected.

Path like menu item - Android

I'm making use of Siyamed's menu item in my app.. I would like to place the menu item in the bottom center of the screen.. and when I click on it, the child items should surround the center icon. Any ideas on how to start?
I recommend you tried another implementation: ArcMenu by daCapricorn.
As the author said on Google+:
If you want to put it align the screen bottom, you can set alignparentbottom="true" in xml and compute the marginBottom (it should be negative) programmatically.
PS: I personnality ended up using ArcMenu library rather than SatelliteMenu for the same issue.

ActionbarSherlock want to insert an image inbetween icon and Tabs

I have a tablet layout using ABS.
The Home (app) icon is displayed and my 4 tabs are shown to the right of it.
I'd like to insert an image (for advertising) inbetween the icon and tabs.
Does anybody know if it can be done?
Thanks in advance.
You can't insert an image between the icon and the tabs, but you could:
A. Use a logo drawable which has the icon and ad in it -- then add this by setting the android:logo attribute on your application or activity to your logo drawable.
or
B. Use a custom view and set this on the ActionBar with setCustomView(View view).

Creating tabs with different heights in Android

How I can create the following layout?
Give those tabs which has not been selected, a background that their top part is transparent and pretends to be shorter than the selected one.

Categories

Resources