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, ...
随机推荐
- 利用insert,update和delete注入获取数据
0x00 简介 利用SQL注入获取数据库数据,利用的方法可以大致分为联合查询.报错.布尔盲注以及延时注入,通常这些方法都是基于select查询语句中的SQL注射点来实现的.那么,当我们发现了一个基于i ...
- hive函数参考手册
hive函数参考手册 原文见:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF 1.内置运算符1.1关系运算符 运 ...
- input上传按钮 文字修改办法
解决思路是把input 放在文字的上边,弄成透明的,这样在点文字时,实际是点击了input,这样就实现了文件的上传. 具体代码: <style> #uploadImg{ font-size ...
- wampserver---------如何让局域网其他电脑访问我的apache
wamp版本:wampserver2.5-Apache-2.4.9-Mysql-5.6.17-php5.5.12-64b 修改方式,看图:修改完记得重启.
- Unity Tidy Tile Pack #1
https://www.assetstore.unity3d.com/cn/#!/content/3276 版本: 1.1 下载地址 密码:mt8a
- Python 进程
安装Python的paramiko模块 步骤: 1:管理员方式打开cmd,切换到python安装路径的Scripts目录下: 2:执行命令: 1 pip3.5.exe install paramiko ...
- JSR 303标准
JSR 303是Java为bean数据合法性校验提供的标准框架,JSR 303通过在Bean属性上标注类似于@NotNull.@Max等标准的注解指定校验规则,并通过标准的校验接口对bean进行验证. ...
- 十二、Java基础---------异常处理机制
异常 异常 异常就是程序在运行时产生的异常情况. 异常的由来 问题也是现实生活中的具体事物,也可以通过java 类的形式进行描述,并封装成对象.异常就是java 对不正常情况进行描述后的对象的体现. ...
- 20145227&20145201 《信息安全系统设计基础》实验一 开发环境的熟悉
北京电子科技学院(BESTI) 实 验 报 告 课程:信息安全系统设计基础 班级:1452 姓名:李子璇 鄢曼君 学号:20145201 20145227 成绩: 指导教师:娄嘉鹏 实验日期:2016 ...
- flexigrid随手记
最近要用到flexigrid做表格,随手记一些知识点. 引入了两个jquery库(jquery.js和jquery-1.7.1.min.js),发生冲突,只保留一个 $("#gridTabl ...



android