Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何将ImageView附加到底板上方?_Android - Fatal编程技术网

Android 如何将ImageView附加到底板上方?

Android 如何将ImageView附加到底板上方?,android,Android,我找到了这篇文章 这里解释一下我需要什么,除了一件我需要改变的事情。我将FloatingActionButton更改为ImageView,因为我需要将ImageView附加到底部纸张上方 那么,我的xml 在初始状态下,它看起来还可以 但当我扩展底部时,我得到了这样的结果 所以,问题是:如何将ImageView附加到底板上方,并且它应该始终位于底板上方,无论底板是展开还是折叠…不要为此使用边距。为ImageView使用layout_DodgeInsetteges=底部属性。查看更多信息 <

我找到了这篇文章

这里解释一下我需要什么,除了一件我需要改变的事情。我将FloatingActionButton更改为ImageView,因为我需要将ImageView附加到底部纸张上方

那么,我的xml

在初始状态下,它看起来还可以

但当我扩展底部时,我得到了这样的结果


所以,问题是:如何将ImageView附加到底板上方,并且它应该始终位于底板上方,无论底板是展开还是折叠…

不要为此使用边距。为ImageView使用layout_DodgeInsetteges=底部属性。查看更多信息

<ImageView
   android:layout_width="170dp"
   android:layout_height="50dp"
   android:src="@drawable/my_image"
   app:layout_anchor="@+id/ll_other_bottom_sheet"
   app:layout_anchorGravity="top|end"
   app:layout_dodgeInsetEdges="bottom" />

将图像保留为底部图纸布局本身的一部分。。然后它将始终位于底部工作表的上方。不使用底部工作表对话框片段
<ImageView
    android:layout_width="170dp"
    android:layout_height="50dp"
    android:layout_marginBottom="60dp"
    android:src="@drawable/my_image"
    app:layout_anchor="@+id/ll_other_bottom_sheet"
    app:layout_anchorGravity="top|end" />
<ImageView
   android:layout_width="170dp"
   android:layout_height="50dp"
   android:src="@drawable/my_image"
   app:layout_anchor="@+id/ll_other_bottom_sheet"
   app:layout_anchorGravity="top|end"
   app:layout_dodgeInsetEdges="bottom" />