我想制作一个包含多个文字和图片的页面。 但是当我把它们放在滚动视图中时,说" ScrollView只能有一个子窗口小部件。如果您想要更多孩子,请将它们包装在容器布局中。" 我不太清楚我做了什么。
答案 0 :(得分:2)
你可以这样做,因为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>