是指在Android应用中,工具栏(Toolbar)的位置没有居中显示在AppBarLayout中。
解决这个问题的方法有多种,以下是其中一种解决方案:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- AppBarLayout中的其他内容 -->
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_centerVertical="true">
<!-- Toolbar中的其他内容 -->
</android.support.v7.widget.Toolbar>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- AppBarLayout中的其他内容 -->
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize">
<!-- Toolbar中的其他内容 -->
</android.support.v7.widget.Toolbar>
</LinearLayout>
以上是一种解决工具栏不在AppBarLayout中心的方法,根据具体情况选择适合的解决方案。
双11音视频
Elastic 实战工作坊
Elastic 实战工作坊
云+社区沙龙online [国产数据库]
北极星训练营
第三期Techo TVP开发者峰会
腾讯数字政务云端系列直播
2024清华公管公益直播讲堂——数字化与现代化
领取专属 10元无门槛券
手把手带您无忧上云