Does anybody know how to set padding between the ActionBar's home icon and the title?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
In your XML, set the
app:titleMargin
in your Toolbar view as following:Or in your code:
I also faced a similar issue, in my case I had to set titles dynamically on each activity depending on the content.
So this worked for me.
If all you want is the spacing, this is the easiest solution I could think of.
this work for me to add padding to the title and for
ActionBar
icon i have set that programmatically.For my case, it was with Toolbar i resolved it like this:
ic_toolbar_drawble.xml
In my Fragment, i check the api :
Good luck!
For me only the following combination worked, tested from API 18 to 24
where in "app" is :
xmlns:app="http://schemas.android.com/apk/res-auto"
for example.
This is a common question in Material Design as you may want to line your toolbars title with the content in the fragment below. To do this, you can override the default padding of "12dp" by using the attribute contentInsetStart="72dp" in your toolbar.xml layout as shown below
toolbar.xml
Then in your activity, call
And you end up with this: