为此,我正在将 android studio 与 java 一起使用。
问题说明 修复内容小的时候在屏幕底部的按钮,如果内容大到可以占据整个屏幕,则在内容的底部。
1.当内容较小
时,当内容足够小以占据整个屏幕时,我想在屏幕底部固定两个按钮。
2.当内容很大
时当内容足够大到占据整个屏幕时,它应该出现在整个内容的底部。当用户向下滚动时,按钮应该出现。在这张图片中,如果我想点击按钮,我已经完全向下滚动了。
这是第二个实现的代码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/eachWord"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:scrollbars="vertical" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/perWordHistory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="History" />
<Button
android:id="@+id/perWordBack"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Back" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
我想使用一个 xml 文件实现这两种方案,但是当内容很小时使用第二种实现,然后按钮位于内容下方而不是屏幕底部。
阿波罗的战车
相关分类