android toolbar 假标题居中
2016-02-18 21:06
471 查看
<android.support.v7.widget.Toolbar android:id="@+id/toolbar_top" android:layout_height="wrap_content" android:layout_width="match_parent" android:minHeight="?attr/actionBarSize"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Toolbar Title" android:layout_gravity="center" android:id="@+id/toolbar_title" /> </android.support.v7.widget.Toolbar>
This means that you can style the TextView however you would like because it’s just a regular TextView. So in your activity you can access the title like so:
Toolbar toolbarTop = (Toolbar) findViewById(R.id.toolbar_top); TextView mTitle = (TextView) toolbarTop.findViewById(R.id.toolbar_title);
1
2
If anyone else can’t remove the default app name title, do this:
1、Call
setSupportActionBar(yourToolbar)
2、
CallgetSupportActionBar().setDisplayShowTitleEnabled(false);`
相关文章推荐
- Android特效专辑(十一)——仿水波纹流量球进度条控制器,实现高端大气的主流特效
- Android特效专辑(十一)——仿水波纹流量球进度条控制器,实现高端大气的主流特效
- android蓝牙技术
- Android开发性能优化大总结
- android简单实例---------------SD卡(外部)存储的使用与讲解
- Android开发规范
- Android布局控件
- 【android】侧滑关闭activity
- Android开发学习之路--Service之初体验
- Android开发学习之路--Service之初体验
- androidpadding和androidmargin的区别
- android中src和background区别
- Android 启动模式和启动标志的关系以及各种适应的使用场合
- Android端使用retrofit上传多张图片,后端使用Php接收图片
- Android防止内存泄露
- Android实现欢迎界面的自动跳转
- Android搜索功能的案例,本地保存搜索历史记录。
- 【Android高级】锁屏功能简单实现
- android driver开发常见的英文缩写
- 新安装Android Studio遇到问题集合+Android Studio整合Genymotion