目前我的代码在屏幕的底部放置一个按钮:对齐屏幕的底部下方的按钮
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center|bottom">
<ImageButton
android:id="@+id/button1"
android:layout_width="95dp"
android:layout_height="95dp"
android:layout_centerInParent="true"
android:gravity="center"
android:src="@drawable/main_button"
/>
</LinearLayout>
</RelativeLayout>
不过,我想对齐略低于屏幕的底部,所以小部分按钮被剪掉(比如20%)。最终,我的最终结果是,当我点击并拖动按钮时,它会向上移动并显示整个按钮,但在此之前,它的底部会被裁剪掉。
有关于如何对齐按钮在屏幕的底部了很多问题,但我似乎无法找到任何它对齐到屏幕的底部之下。
有没有办法做到这一点,或者我没有使用正确的搜索条件?
编辑:从答案,我想机器人:translationY =“20dp”,它没有工作,但我想机器人:layout_marginBottom =“ - 20dp”,它为我工作。
如果你可以将其调整的底部,那么你就可以添加上边距来推动它关闭屏幕 –