ikb*_*bal 8 user-interface android scrollview android-linearlayout
我需要在屏幕顶部设计一个不滚动内容的GUI,以及滚动顶部的内容.我想过将LinearLayout用于非滚动部分,使用ScrollView作为滚动部分.但是,当我尝试在LinearLayout之后使用ScrollView时,我收到运行时错误.是否可以将LinearLayout和ScrollView添加到父LinearLayout?
Jos*_*arl 17
您可以
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<!-- non-scrolling top pane -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This text will not scroll"
/>
</LinearLayout>
<!-- scrolling bottom pane -->
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="This text will scroll if it is long enough..."
/>
</LinearLayout>
</ScrollView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20648 次 |
| 最近记录: |