0
我有以下的ImageButton格式:堆栈ImageButtons彼此
<ImageButton
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
style="?android:attr/buttonStyleSmall"
android:text="New Button"
android:layout_width="30dp"
android:layout_height="30dp"
android:scaleType="fitXY"
android:layout_alignParentTop="true"/>
这里是容器布局(注意ID)
<ScrollView
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_below="@+id/textView"
android:layout_marginTop="5dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<GridLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
----> android:id="@+id/ADDING IMGBUTTONS HERE"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
</GridLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/ADDING IMGBUTTONS HERE"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"></LinearLayout>
</RelativeLayout>
</ScrollView>
imagebuttons被添加,但只有并排,并最终继续被添加到屏幕外。图像按钮的指定空间可用于2x2x2x2x2的网格,所以这就是我想要的,每行两个图像。现在发生的事情是按行排列的“无限”图像,尽管我只能看到两个图像,因为其他图像会被添加到屏幕外。我怎样才能在布局中避免这种情况?
OMFG,惊艳... tysm – Fane