zoukankan      html  css  js  c++  java
  • ScrollView can host only one direct child

    1.xml:

     关键点:  <ScrollView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

    可以放在任何地方,但是有一点要注意, ScrollView can host only one direct child

    意思就是说, scrollview 下面的子项,必须是一个整体,不能有多个项

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        >
    <!--  android:scrollbarAlwaysDrawVerticalTrack="true" -->
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
    
            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Button" />
        </LinearLayout>
    
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
    
            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Button" />
        </LinearLayout>
    
        <ScrollView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >
    
            <LinearLayout
                android:orientation="vertical"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >
    
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
    
                    <Button
                        android:id="@+id/button1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Button" />
                </LinearLayout>
    
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
    
                    <Button
                        android:id="@+id/button1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Button" />
                </LinearLayout>
    
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
    
                    <Button
                        android:id="@+id/button1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Button" />
                </LinearLayout>
    
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
    
                    <Button
                        android:id="@+id/button1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Button" />
                </LinearLayout>
    
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
    
                    <Button
                        android:id="@+id/button1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Button" />
                </LinearLayout>
    
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
    
                    <Button
                        android:id="@+id/button1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Button" />
                </LinearLayout>
    
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
    
                    <Button
                        android:id="@+id/button1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Button" />
                </LinearLayout>
    
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
    
                    <Button
                        android:id="@+id/button1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Button" />
                </LinearLayout>
    
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
    
                    <Button
                        android:id="@+id/button1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Button" />
                </LinearLayout>
    
                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
    
                    <Button
                        android:id="@+id/button1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Button" />
                </LinearLayout>
                 <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
    
                    <Button
                        android:id="@+id/button1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Button" />
                </LinearLayout>
                 <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
    
                    <Button
                        android:id="@+id/button1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Button" />
                </LinearLayout>
                 <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
    
                    <Button
                        android:id="@+id/button1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="Button" />
                </LinearLayout>
            </LinearLayout>
        </ScrollView>
    
    </LinearLayout>
    
  • 相关阅读:
    BroadcastReceiver之发送自定义无序广播
    BroadcastReceiver之应用卸载和安装监听
    Android几种打开SQLite的方法
    BroadcoastReceiver之短信到来监听和获取内容
    BroadcastReceiver之SD的挂载监听
    BroadcastReceive之ip拨号
    Activity之多启动图标
    Uwp Windows10获取设备位置(经纬度)
    DeviceFamily XAML Views(一)
    [SCOI2010]生成字符串
  • 原文地址:https://www.cnblogs.com/childhooding/p/4462177.html
Copyright © 2011-2022 走看看