fix: 返回按钮改用透明覆盖层方案
标题栏改为 FrameLayout,图标保持原样 上层叠一个 120dp 宽的透明 View 覆盖左半边 点击左半边任意位置都触发返回,不影响视觉 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,43 +10,36 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- ===== 固定标题栏(不随内容滚动) ===== -->
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="21dp"
|
||||
android:paddingBottom="4dp">
|
||||
|
||||
<!-- 返回按钮:整个左半边可点击,图标靠左 -->
|
||||
<FrameLayout
|
||||
android:id="@+id/btnBack"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_weight="1"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
<!-- 标题栏内容 -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="21dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:paddingStart="21dp"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="\ue6bd"
|
||||
android:fontFamily="@font/iconfont"
|
||||
android:textColor="@color/text_primary"
|
||||
android:textSize="28sp" />
|
||||
</FrameLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="20sp" />
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/text_secondary"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvPageNum"
|
||||
@@ -58,7 +51,16 @@
|
||||
android:minWidth="37dp"
|
||||
android:gravity="end" />
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 透明覆盖层:左半边都是返回点击区域 -->
|
||||
<View
|
||||
android:id="@+id/btnBack"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<!-- ===== 可滚动内容区(标题和按钮之间) ===== -->
|
||||
<FrameLayout
|
||||
|
||||
Reference in New Issue
Block a user