MD设计之ToolBar
2015-10-21 10:54
309 查看
ToolBar是在android v7包中,使用时在gradle 中添加:compile'com.android.support:appcompat-v7:22.2.1' 其中22.2.1是v7包的版本,根据具体环境选择!
注意:xml文件中使用的时候一定注意ToolBar和android.support.v7.widget.Toolbar的区别,不要导错了, 如果要设置标题居中,只需要在布局里加入一个textview即可
注意:xml文件中使用的时候一定注意ToolBar和android.support.v7.widget.Toolbar的区别,不要导错了, 如果要设置标题居中,只需要在布局里加入一个textview即可
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" app:backgroundTint="#ff0000" app:subtitle="subtool" app:navigationIcon="@drawable/ic_launcher" app:title="tool" app:titleTextColor="@color/abc_search_url_text" app:titleMargins="10dp"> <TextView android:layout_width="50dp" android:layout_height="wrap_content" android:layout_gravity="center" android:textSize="20sp" android:text="tool"/> </android.support.v7.widget.Toolbar> </RelativeLayout>
相关文章推荐
- ecplise中git的提交/更新
- Windows下的Objective-C集成开发环境(IDE)
- 二维码扫描
- [LeetCode]Maximum Depth of Binary Tree
- 有边框的EditText的高度
- 单例模式的双层锁原理
- linux .deb 包的制作
- JMX简介
- Android程序监听已知包名的APK是否运行
- 文件透明加解密的实现层次
- Maven---leaning01
- Tomcat热部署方法(3种)
- 标准linu休眠和唤醒机制分析(四)
- win7下如何建立ftp服务器
- MATLAB中的分类器
- SVD与PCA
- struts2使用总结
- PHP中使用substr()截取字符串出现中文乱码问题该怎么办
- ADAS一些技术应用小结
- 【1012】畅通工程