你如何让一个LinearLayout中滚动? [英] How do you make a LinearLayout scrollable?

查看:1472
本文介绍了你如何让一个LinearLayout中滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多在屏幕上的项目,我需要使用滚动条,使用户可以向下滚动。然而,滚动或者是不可见的,或者它不工作。这怎么可能给一个滚动条添加到的LinearLayout

I have lot of items on the screen and I need to use the scrollbar so the user can scroll down. However, the scroll is either not visible or it's not working. How is it possible to add a scrollbar to a LinearLayout?

推荐答案

裹线性布局与<滚动型>

见这里的一个例子:

 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout 
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
       xmlns:android="http://schemas.android.com/apk/res/android">
       <ScrollView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content">
            <LinearLayout 
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:orientation="vertical">
                  <!-- Content here -->
            </LinearLayout>
      </ScrollView>
 </LinearLayout>

这篇关于你如何让一个LinearLayout中滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆