android标题居中返回男,Android toolbar 标题精确居中 不会因返回键偏移

1. 总的布局文件

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:orientation="vertical"

tools:context="com.gx.gxzx.ui.realtime.commonElec.CommonElecActivity">

android:layout_width="match_parent"

android:layout_height="wrap_content"

xmlns:app="http://schemas.android.com/apk/res-auto">

android:layout_width="match_parent"

app:layout_scrollFlags="scroll|enterAlways|snap"

android:layout_height="wrap_content">

android:id="@+id/my_toolbar"

android:paddingTop="20dp"

app:contentInsetStart="0dp"

android:layout_width="match_parent"

android:layout_height="wrap_content">

android:layout_width="match_parent"

android:layout_height="wrap_content">

android:id="@+id/my_toolbar_back"

android:src="@drawable/ic_back_white"

android:background="?controlBackground"

android:layout_margin="10dp"

android:layout_centerVertical="true"

android:layout_width="25dp"

android:layout_height="25dp" />

android:id="@+id/my_toolbar_loading"

android:layout_centerVertical="true"

android:layout_toLeftOf="@+id/my_toolbar_title"

android:layout_width="25dp"

android:layout_marginRight="10dp"

android:layout_height="25dp" />

android:id="@+id/my_toolbar_title"

android:text="tltie"

android:textColor="@color/white"

android:textSize="@dimen/title"

android:gravity="center"

android:layout_centerInParent="true"

android:layout_width="wrap_content"

android:layout_height="wrap_content" />

android:id="@+id/my_device_selector"

android:layout_width="match_parent"

android:layout_height="wrap_content"/>

android:id="@+id/swipe_refresh_layout"

android:layout_width="match_parent"

android:layout_height="match_parent"

app:layout_behavior="@string/appbar_scrolling_view_behavior">

android:layout_width="match_parent"

android:layout_weight="1"

android:layout_height="0dp">

....

#2. 要点 ##2.1 app:contentInsetStart="0dp"

会使toolbar里面的View会扩充到左右,不会有间隙。

2.2 android:background="?controlBackground"

这个点击效果不错,圆形的灰色背景

2.3 下拉刷新

SwipeRefreshLayout 要包裹着NestedScrollView才会有下拉效果

2.4 ActionMenuView

ActionMenuView 可以添加菜单按钮

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器学习模型机器
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值