【发布时间】:2019-05-24 16:24:54
【问题描述】:
嵌套在协调器布局中的fragment 中的以下按钮display_current_month 和display_current_year 在上半部分不可点击。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/activity_custom_calendar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp">
<Button
android:id="@+id/display_current_month"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"/>
<Button
android:id="@+id/display_current_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toEndOf="@id/display_current_month"
android:layout_marginTop="15dp"/>
<LinearLayout
android:id="@+id/calendar_days_of_week"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/display_current_month"
android:orientation="horizontal">
</LinearLayout>
</RelativeLayout>
协调器布局:
<android.support.design.widget.AppBarLayout
android:id="@+id/reminders_app_bar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_rounded_rectangle">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/reminders_collapsing_toolbar_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<android.support.v4.view.ViewPager
android:id="@+id/calendar_view"
android:layout_width="match_parent"
android:layout_height="380dp"
android:layout_margin="5dp"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
附上带有实际按钮的屏幕截图。非常感谢任何帮助。
附:按钮似乎有一个底部填充,允许在其边框下方约 10 dp 处单击按钮。
【问题讨论】: