[英]How to prevent editText from overlapping other view?
我想你需要这个
<ScrollView>
<RelativeLayout>
<EditText></EditText>
<EditText android:marginTop = "10dp"> </EditText>
</RelativeLayout>
</ScrollView>
或者
<RelativeLayout>
<ScrollView>
<EditText></EditText>
<EditText android:marginTop = "10dp"> </EditText>
</ScrollView>
</RelativeLayout>
如果您想堆叠它们,最好使用 LinearLayout(使用方向 = 垂直),但如果您想坚持使用 RelativeLayout,这就是您可以做到的。 关键是android:layout_below
属性。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="@+id/edittext1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello"
android:layout_alignParentTop="true"/>
<EditText
android:id="@+id/edittext2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="baby"
android:layout_below="@+id/edittext1"
/>
</RelativeLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.