ToolBar修改返回按钮图标
来源:互联网 发布:太原网站搜索引擎优化 编辑:程序博客网 时间:2024/05/17 22:26
使用Toolbar时,有时因为不同的手机设备,不能使用系统默认的主题样式或者图标,必须指定特定的资源,防止APP在不同设备上的效果不一样!
我在使用Toolbar时,把这个布局作为一个公共的了,所以修改起来比较容易,下面是该Toolbar的布局文件:
<?xml version="1.0" encoding="utf-8"?><android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:id="@+id/toolbar" android:layout_height="wrap_content" android:background="?attr/day_actionbar_bg"> <TextView android:id="@+id/tv_title" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="center" android:textSize="@dimen/actionbar_txtSize" android:textColor="?attr/common_login_txtbg"/></android.support.v7.widget.Toolbar>
在跟节点加上这几句i就可以了:
xmlns:app="http://schemas.android.com/apk/res-auto" app:navigationIcon="@drawable/navigationIcon" android:navigationIcon="@drawable/navigationIcon"
就可以修改返回按钮的图标样式了,
完整的布局代码是这样的:
<?xml version="1.0" encoding="utf-8"?><android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:id="@+id/toolbar" xmlns:app="http://schemas.android.com/apk/res-auto" app:navigationIcon="@drawable/navigationIcon" android:navigationIcon="@drawable/navigationIcon" android:layout_height="wrap_content" android:background="?attr/day_actionbar_bg"> <TextView android:id="@+id/tv_title" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="center" android:textSize="@dimen/actionbar_txtSize" android:textColor="?attr/common_login_txtbg"/></android.support.v7.widget.Toolbar>
修改返回按钮成功!
Menu菜单文字的颜色修改:
使用ToolBar时,需要右上角的菜单按钮,菜单的文字按钮颜色也需要修改,在app的主题里修改就可以了,主题中加个:
<item name="android:actionMenuTextColor">#329da3</item>
但只有menu中item设置showAsAction为always的时候才有用,
0 2
- ToolBar修改返回按钮图标
- Android ToolBar修改返回按钮图标
- 按钮图标修改
- 改变ToolBar按钮图标的方法
- swift设置返回按钮图标
- 修改toolbar原生返回键颜色
- 修改Toolbar返回按钮的颜色
- Android Toolbar返回按钮颜色修改
- Toolbar修改高度后返回按钮不能居中的解决方法
- Toolbar修改字体颜色与添加返回键
- 修改toolbar
- Toolbar的三个问题:修改左边箭头颜色、怎样修改右边以及子activity中的toolbar添加返回箭头
- Toolbar的三个问题:修改左边箭头颜色、怎样修改右边以及子activity中的toolbar添加返回箭头
- toolbar显示返回箭头
- Android 仿知乎日报在切换Fragment页面,按back返回时,同步修改Toolbar的title。
- android 修改Toolbar 返回按钮的颜色以及自定义的图片
- Android之Toolbar的三个问题:修改左边箭头颜色、怎样修改右边以及子activity中的toolbar添加返回箭头
- Android 修改 Toolbar 高度
- 线程特定的存储器
- Timus 1293. Eniya
- Spark组件之SparkR学习4--Eclipse下R语言环境搭建
- 史上最全前端面试题(含答案)
- 【C#设计模式-抽象工厂模式】
- ToolBar修改返回按钮图标
- STL中map用法详解
- ZOJ 3878Convert QWERTY to Dvorak
- 大数阶乘末尾0的个数问题 数字的奇妙
- scrollview中linearlayout布局不全屏
- 【HDU】 1222 Wolf and Rabbit
- Spring MVC 3.0版本 深入讲解
- 怎样删除保存的无线上网WiFi密码
- 自我学习--内存管理