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
Related
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
I'm trying to implement an Material Design like Toolbar including a search (using the support SearchView).
I run into the problem that I can't get the SearchView start at the same position (72dp from the left border) as the title. It's some dp more right than the title. How can I fix this?
I put contentInsetStart="72dp" to the toolbar for getting the title at the mentioned line, but the SearchView now starts like 100dp from the left.
I want to have it like this:
The right solution for my problem was setting app:titleMarginStart="16dp" for the android.support.v7.widget.Toolbar.
Try to override abc_dropdownitem_text_padding_left to 0dp or negative value using ref.xml. Default value is 8dp, when you add 72dp content inset this will move all content to right including their padding which contribute to those you see as 100dp.
Screenshot from Bigbasket App
I have achieved same thing by custom layout. But is there way we can put text above fab provided by android.
The FloatingActionButton extends ImageButton, which does not support text.
If you want to achieve the effect in your link using the native FloatingActionButton, you'll need to create a different icon for each digit you want to represent.
Add a textview and make it above the floating action button at centre using relative layout params and elevation attribute. You need to check for click of both I guess.
You can see this answer for elevation attribute.
I'm new to Android development and I'm trying to implement some custom buttons, they should look something like this:
So I was wondering if I can use something like a imagebutton and use the image as a background and add text on top of it (I tried this but the text is always in the middle and doesn't have a label so its hard to see..), or should I write a custom style or theme for my button. In case that I have to write a custom style or theme, could you please help me out with this? How should I go about doing it?
For each of those Grid elements, create a framelayout for each, put the background and then the label in front. Frame layouts allow things on top of each other. You can put the labels with layout_gravity bottom and also add a transparent color to it so the image in the back can be seen. Also add a onClickListener to each of the framelayouts so they act as buttons.
I know how to make the gradient and the logo. But I don`t know how to add all that different borders and how to add the refresh icon (that also has some custom border around it).
Instagram Action Bar:
How is that possible?
You can do it by using a horizontal LinearLayout with 2 children, the left hand column with the logo and the right hand column with the refresh button. You can create a background drawable using the Shape XML:
http://developer.android.com/guide/topics/resources/drawable-resource.html#Shape
I'd look at the provided ActionBar and ActionBarCompat. It has hooks for producing basic, as well as complex action bars.