请确保您将version/encoding
行保留在文件最顶端。
将RelativeLayout
更改为ScrollView
,然后在该新的ScrollView
中嵌套RelativeLayout
部分(包含所有小部件)。
确保你给RelativeLayout
某些方面,这应该是一样的ScrollView
宽度和高度尺寸。
嵌套RelativeLayout
包含所有小部件的原因是ScrollView
元素只能有一个子元素(在这种情况下,RelativeLayout
,然后它有自己的孩子)。
因此,该代码:
<?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" >
<!-- all your widgets -->
</RelativeLayout>
打开这个代码:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- all your widgets -->
</RelativeLayout>
</ScrollView>
我不是downvoting .. – Aravin
@ 753它看起来并不像你对我已经接受任何答案 –