Is there anyway to margin ActionBar title programatically? My context is:
I use my main Activity with NoActionBar theme. So i use a toolbar as Actionbar. I have many fragments using as different screen in Main Activity. I want to margin some of fragment title.
Thank in advance.
There are some rules for accuracy of designing ...
they are define as belove with image..
1. your image view
margin of image view from left edge is always 16
2.your textview
margin of your textview from left edge is always 72
Thats why all our android application should work properly...and at least same lookup...
please follow this link for material designing....Link
hope it help a lots...
Related
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
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.
Basically, I want to make sure my UI elements (TextViews, Buttons, etc) are left aligned with the ActionBar logo. My idea was to try to find out the left spacing between the edge of the screen and the left side of the logo (shown highlighted in blue in the attached image), and use this value as the left margin for the UI elements in my Activity, but I've been unable to get this value.
So, how can I get the value of this margin? Or, is there a better way of accomplishing this?
Thanks.
Just use the standards for defining paddings as described in the Android Design documents on d.android.com. This page gives a good example of how your layout must be structured in terms of paddings between elements.
You check these answers . Custom layout for the action bar worked for me to change this padding and you can also get padding value.
remove padding around action bar left icon on Android 4.0+
Its possible that a layout contain a actionbar?
Or change the width of the actionbar?
For this part of my application i dont need a fragmentactivity, so this is a simple activity
Sorry by my English..
Green: Layouts
Red:Actionbar
If You want that your actionbar appears in some part of screen you should use Customlayout with the use of "Include Other Layout Option" in your screen..
or If you want to customize your actionbar, You Can Use Custom Actionbar.
http://javatechig.com/android/actionbar-with-custom-view-example-in-android