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>
    
  • 相关阅读:
    EF性能优化-有人说EF性能低,我想说:EF确实不如ADO.NET
    MiniProfiler工具介绍(监控EF生成的SQL语句)--EF,迷你监控器,哈哈哈
    C# 数据库并发的解决方案(通用版、EF版)
    锁、C#中Monitor和Lock以及区别
    LINQ 如何动态创建 Where 子查询
    C# Npoi 实现Excel与数据库相互导入
    MVC ActionResult派生类关系图
    如何构造树状 JSON 数据 JSON-Tree
    如何构造分层次的 Json 数据
    如何使用 GroupBy 计数-Count()
  • 原文地址:https://www.cnblogs.com/childhooding/p/4462177.html
Copyright © 2011-2022 走看看