【发布时间】:2019-06-04 13:28:14
【问题描述】:
我有一个CoordinatorLayout,其中我有一个BottomSheet 和一个ImageView。
这是我的 BottomSheett:
<include layout="@layout/bottom_sheet_layout"
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:behavior_hideable="false"
app:behavior_peekHeight="80dp"
app:layout_behavior="@string/bottom_sheet_behavior"/>
这是我的ImageView:
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/image_location_crosshairs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:layout_marginRight="20dp"
app:layout_anchorGravity="top|end"
app:layout_anchor="@id/bottom_sheet"
app:srcCompat="@drawable/my_svg_icon"/>
无论我的 XML 布局中的视图顺序如何,我总是得到相同的结果:我的 ImageView 很好地锚定到了底页,但锚点位于图像的中心。
我想知道如何将图像底部而不是其中心锚定。 尝试应用任何类型的底边距只会让底页滑动,直到到达图像中心,然后再制作图像幻灯片。
感谢您的帮助!
【问题讨论】:
标签: android android-coordinatorlayout bottom-sheet