Android 在滚动视图的底部放置一些内容
我有以下代码:Android 在滚动视图的底部放置一些内容,android,android-layout,Android,Android Layout,我有以下代码: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/background_box"> <ScrollView andr
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_box">
<ScrollView
android:id="@+id/main_scroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true">
[... center stuff]
</ScrollView>
<RelativeLayout
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:id="@+id/auth_non_auth_bottom"
android:layout_below="@+id/main_scroll">
[... buttons and stuff]
</RelativeLayou>
</RelativeLayout>
[…中心材料]
[…按钮和其他东西]
在Scrollview中有一个EditText。由于EditText可以更改其高度,所以Scrollview可以在将其推到视图外的相对位置上运行
但是,如果我将RelativeLayout与parentBottom放在一起,它会在键盘上方,在键入时隐藏编辑文本,因此用户无法写入。。。如果我把RelativeLayout放在scrollview中。。它不会在视图的底部
有什么想法可以实现将RelativeLayout放在底部但不隐藏EditText(位于中心区域)的目标?谢谢 我更愿意做如下事情:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/background_box">
<ScrollView
android:id="@+id/main_scroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity="center_horizontal">
<EditText
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:lines="3"
android:inputType="textMultiLine"
android:id="@+id/description"
android:clickable="true"/>
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/auth_non_auth_bottom"
android:layout_below="@+id/main_scroll">
<!--[... buttons and stuff]-->
</RelativeLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>
我做到了!这样:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/background_box">
<ScrollView
android:id="@+id/main_scroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginBottom="50dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
[...]
</LinearLayout>
</ScrollView>
<RelativeLayout
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/auth_non_auth_bottom"
android:layout_alignParentBottom="true"/>
</RelativeLayout>
[...]
我在ScrollView中设置了一个marginBottom,以便查看editText字段:)它不在底部:(你能分享你真正想要实现的屏幕短片或图像吗?