請確保您將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它看起來並不像你對我已經接受任何答案 –