Android Toolbar Padding
来源:互联网 发布:手机网络正常微信不能 编辑:程序博客网 时间:2024/06/09 16:09
版权声明:本文为博主原创文章,未经博主允许不得转载。(这是本人博客园博客也有同类文章)
在API version 21 (the support library),如何正常使用Toolbar
这是常规式布局出来的Toolbar,我设置了bg,明显左边和上面都有边距:
然后,我更改后的代码如下:
<android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_height="wrap_content" android:layout_width="match_parent" android:background="?attr/colorPrimary" android:padding="0dp" android:layout_margin="0dp"> <RelativeLayout android:id="@+id/action_bar_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="0dp" android:padding="0dp" android:background="#000000"> <Spinner android:layout_width="wrap_content" android:layout_height="wrap_content"/> </RelativeLayout></Toolbar>
你会发现设置padding为0这个属性是没有用的,直接看下面效果图:
这显示我设置的spinner为72dp了。
Edit 1
我需要正常的显示我的spinner,去掉padding,Here I going to find Google API:
Edit 2
下面我将contentInsetStart设置为0。您将需要使用的支持库应用程序名称空间:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_height="wrap_content" android:layout_width="match_parent" android:minHeight="@dimen/action_bar_height" android:background="?attr/colorPrimary" android:contentInsetStart="0dp" android:contentInsetLeft="0dp" app:contentInsetLeft="0dp" app:contentInsetStart="0dp" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"></android.support.v4.widget.DrawerLayout>
希望能帮到别人,这个困扰了我近一天的question!
版权声明:本文为博主原创文章,未经博主允许不得转载。
0 0
- Android Toolbar Padding
- Android - toolbar 优化 title修改边距和navigation icon修改padding值
- Android Toolbar
- android ToolBar
- android toolbar
- Android Toolbar
- Android ToolBar
- Android Toolbar
- android toolbar
- Android ToolBar
- Android Toolbar
- ANDROID Toolbar
- Android Toolbar
- android margin/padding区别
- android margin/padding区别
- android setbackgroundresource changes padding
- android margin vs padding
- android padding margin区别
- 关键字
- iOS中如何更改状态栏的字体颜色(白色、黑色字体)
- java泛型趣点
- sublime zen-coding
- struts2国际化问题
- Android Toolbar Padding
- Android开发笔记(十)常用的图片加工操作
- php生成静态html页面的简单实现
- iOS push 横屏
- JPA的注解的基本使用
- C语言基础
- 二进制转八进制vb6程序
- 从源码上理清springmvc用注解方式使用的流程脉络(上)
- '调用K3组件反审核单据