简体   繁体   English

滚动视图与多子

[英]Scroll View with multi child

I want to make a page with a several text and images. 我要制作一个包含多个文本和图像的页面。 but when I put them in the scroll view, says "ScrollView can only have one child widget. If you want more children, wrap them in a container layout." 但是当我将它们放在滚动视图中时,会说:“ ScrollView只能有一个子窗口小部件。如果要更多子窗口,请将它们包装在容器布局中。” I do not understand well what shoud I do. 我不明白我该怎么做。

You can do like this as a scrollview can have only one direct child, you have to put a viewgroup like linearlayout, relativelayout, etc. 您可以这样做,因为滚动视图只能有一个直接子级,您必须放置一个诸如linearlayout,relativelayout等的视图组。

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

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <ProgressBar
                android:id="@+id/progressBar"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:layout_gravity="center" />

            <TextView
                android:id="@+id/textViewNoInternet"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:text="@string/check_your_internet_connection"
                android:textColor="@color/black_transparent_60"
                android:textSize="16dp" />
         </LinearLayout>

    </ScrollView>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM