3.android 关于ScrollView不能显示

关于ScrollView不能显示  老报错  是因为ScrollView不能直接嵌套很多布局或是控件,最好让他套一个总布局。

//---------------------------------------例如:

//这第一种 这种布局ScrollView的嵌套,ScrollView嵌套了TextView,如果是这样的话,ScrollView根本无法正常显示出来!

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

        <TextView
            android:text="aaaa"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
        <TextView
            android:text="bbbb"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

</ScrollView>

 

//第二种 ScrollView嵌套RelativeLayout,RelativeLayout里再嵌套TextView,以下这种方式才可以让ScrollView正常显示。

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="300dp">
    <TextView
        android:text="aaaa"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    <TextView
        android:text="bbbb"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    </RelativeLayout>

</ScrollView>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值