Android API 21 Toolbar Padding
How do I get rid of the extra padding in the new Toolbar with Android SDK API version 21 (the support library)? I am talking about the red arrows on this picture: Here is the code I am using:
As you can see I've set all the relevant padding to 0, but there is still padding around the Spinner. What have I done wrong or what do I need to do to get rid of the extra padding? Edit Some have questioned why I am trying to do this. As per the Material Design specs, the spinner should be 72dp from the left side I need to neutralize the padding Google have put there in order to properly place my spinner: Edit 2 As per Chris Bane's answer below I set the contentInsetStart to 0. For the support library you will need to use the app namespace:
I hope this helps someone, it had me confused for several days. |
|||||||||
|
The left inset is caused by Toolbar's Change this to 72dp to align to the keyline. Update for support library v24.0.0: To match the Material Design spec there's an additional attribute |
|||||||||||||||||||||
|
Above answer is correct but there is still one thing that might create issues (At least it did create an issue for me) I used the following and it doesn't work properly on older devices -
The trick is here just use the following -
and get rid of -
And now it should work fine throughout all the devices. Hope it helps. |
|||||||||||||||||||||
|
Make your toolbar like:
You need to add
attribute to add spacing please follow this link for more - Android Tips
|
Android API 21 Toolbar Padding的更多相关文章
- Google Maps Android API v2 (1)- 入门
才可以开始工作的API,你将需要下载的API,并确保你有一个谷歌地图Android的API V2关键.API和关键是免费提供的. 概观 获得谷歌地图Android的API V2 谷歌地图API密钥 显 ...
- 【Android】21.1 画板资源
分类:C#.Android.VS2015: 创建日期:2016-03-19 一.简介 画板资源(Drawable Resources)是用XML描述/Resources/drawable中的2D图形文 ...
- Android API level 与version对应关系
https://www.cnblogs.com/jinglecode/p/7753107.html Platform Version API Level VERSION_CODE 中文名称 Andro ...
- Android 如何在Eclipse中查看Android API源码 及 support包源码
当我们阅读android API开发文档时候,上面的每个类,以及类的各个方法都是已经写好的方法和控件,可是我们只是在搬来使用,不知道它的原理,它是如何被实现的.android系统是开源的,所以谷歌官方 ...
- 搜索 录音功能 Android api
搜索 录音功能 Android api http://www.oschina.net/android/47/ http://m.blog.csdn.net/blog/u011309801/406523 ...
- Android API Guides 学习笔记---Application Fundamentals(一)
今天开始学习google官网上的API guides ,主要读了Application Fundamentals这一章节,此章节介绍了一个App的基本组成,共包括四大部分内容. 1. App ...
- Instant Buy Android API Tutorial
转自:https://developers.google.com/wallet/instant-buy/android/tutorial This tutorial guides you throug ...
- 【Android Api 翻译3】android api 完整翻译之Application Fundamentals (学习android必须知道的)
Android应用程序是用Java编程语言编写的.Android SDK工具把应用程序的代码.数据和资源文件一起编译到一个Android程序包中(这个程序包是以.apk为后缀的归档文件),一个Andr ...
- 【Android Api 翻译1】Android Texting(2)Testing Fundamentals 测试基础篇
Testing Fundamentals The Android testing framework, an integral part of the development environment, ...
随机推荐
- Hibernate n+1问题
转自: http://www.blogjava.net/RoyPayne/archive/2012/01/30/369017.htmlhttp://msi110.iteye.com/blog/7101 ...
- Android 自定义RecyclerView 实现真正的Gallery效果
http://blog.csdn.net/lmj623565791/article/details/38173061
- vim - Highlight unwanted spaces
http://vim.wikia.com/wiki/VimTip396 precondition: set hlsearch" Show all tabs:/\t" Show tr ...
- Android Studio 开发环境设置
修改字体(File=>Settings 按下如所图设计字体) 显示行号.空格 用 制表符 代替 空格 显示 最终代码显示如下图 格式化代码 使用 Ctrl+Alt+L
- javascript序列化json 第二篇
这一节主要是记录父子关系的JSON生成,废话不多说,直接上代码. public partial class _default : System.Web.UI.Page { public static ...
- linux vagrant visual box 虚拟机比较慢
提现在跑本地虚拟机开发环境很慢,直接影响工作效率,网上搜了,亲测可用. cite: http://leo108.com/pid-2072.asp 在 vagrantfile中加入 config ...
- Java关于md5+salt盐加密验证
一.陈述一下工作流程: 1.根据已有的密码字符串去生成一个密码+盐字符串,可以将盐的加密字符串也存放在数据库(看需求), 2.验证时将提交的密码字符串进行同样的加密再从数据库中取得已有的盐进行组合密码 ...
- SQL复制一个表的数据到另一个表
最近做一个项目,由于客户数据量大,为了不将数据彻底删除,于是将数据移动到历史表,原始表的数据删除.由于技术有限,想不到好的方法,于是写个存储过程 执行,为了防止执行过程中出现异常,执行不完整.用到hI ...
- 通过Trainingkit对Azure有一个初步的了解
学习Azure有一个非常不错的资料库Azure training kit. 这里面包含了很多Azure团队编写的实例代码,以及为初学Azure的开发人员准备的新手教学课程. 开发人员可以从http:/ ...
- 五、Standard Controllers
1.standardController:标准的controller 是同页面的standard Object的界面button的功能和逻辑是一样的<apex:page standardCont ...