Yaz*_*eeb 0 xml layout android scrollview
我在布局中使用 ScrollView,如下所示:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- my rest xml code-->
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
然后我的布局预览显示如下:
为什么布局看起来像这样?!
这只是因为您用作ScrollView根视图。
根据需要更改根视图(LinearLayout/RelativeLayout/FrameLayout)并在根视图下添加 ScrollView 作为子布局。
例如
<LinearLayout
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="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- your rest xml code-->
</LinearLayout>
</ScrollView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你。
| 归档时间: |
|
| 查看次数: |
5912 次 |
| 最近记录: |