Java 具有多个子对象的滚动视图
我想制作一个包含多个文本和图像的页面。 但是当我把它们放在滚动视图中时,上面说“滚动视图只能有一个子部件。如果你想要更多的子部件,请将它们包装在容器布局中。”Java 具有多个子对象的滚动视图,java,android,ide,scrollview,Java,Android,Ide,Scrollview,我想制作一个包含多个文本和图像的页面。 但是当我把它们放在滚动视图中时,上面说“滚动视图只能有一个子部件。如果你想要更多的子部件,请将它们包装在容器布局中。” 我不太明白我该做什么 您可以这样做,因为scrollview只能有一个直接子视图,您必须放置一个视图组,如linearlayout、relativelayout等 <ScrollView android:layout_width="match_parent" android:layout_he
我不太明白我该做什么 您可以这样做,因为scrollview只能有一个直接子视图,您必须放置一个视图组,如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>
您可以这样做,因为scrollview只能有一个直接子视图,您必须放置一个视图组,如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>