在下面的代码中,我有两个主要容器,一个RelativeLayout和一个ScrollView。我需要将RelativeLayout固定在最上面,并在下面使ScrollView和Images滚动。我有以下两个问题:
垂直LinearLayout中显示的我的图像视图为缩略图大小。如果我有15-20张图像,则它们会占用很多垂直空间。如何根据屏幕尺寸使图像适合一行中的最大值,然后转到下一行?
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</RelativeLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView>
</ImageView>
<ImageView>
</ImageView>
<ImageView>
</ImageView>
<ImageView>
</ImageView>
</LinearLayout>
</ScrollView>
按照以下简单方法进行操作:
<RelativeLayout>
。ScrollView
为match_parent
。LinearLayout
。最后,您将得到以下结果:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</RelativeLayout>
</LinearLayout>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句