В моем приложении я хочу отобразить 5 изображений в 2 столбца и 3 строки
Image1 фактически охватывает столбик 1 строки 1 и строки 2. остальные все изображения занимают только одну клетку
ТАК макет
image1 image2
image3
image4 image5
из-за этого охвата строки я не могу использовать вид сетки или табличный макет
Я попытался определить в рамках линейного и относительного расположения.
Но я не могу правильно выровнять клетки.
Пожалуйста, предложите помочь мне здесь. Я хочу определить таким образом, чтобы размеры изображений были изменены в соответствии с размером экрана
Пожалуйста, посмотрите XML, который я определил. Я добавил несколько опций, чтобы все выглядело так, как я хотел.
<LinerLayout .. >
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView android:id="@+id/image1" android:layout_width="wrap_content"
android:src="@drawable/img1" android:layout_height="wrap_content"
android:layout_below="@+id/text1view" />
<ImageView android:id="@+id/image2"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/image1" android:src="@drawable/imqge2"
android:layout_below="@+id/text1view" android:onClick=""
android:layout_alignTop="@+id/image1" android:layout_alignParentRight="true"/>
<ImageView android:id="@+id/image3"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@+id/image1" android:src="@drawable/image3"
android:layout_below="@+id/image2" android:onClick=""
android:layout_alignBottom="@+id/image1" android:layout_alignLeft="@+id/image2"
android:layout_alignParentRight="true" />
<ImageView android:id="@+id/image4"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/image4" android:layout_alignParentBottom="true"
android:layout_below="@+id/image1" android:onClick="" />
<ImageView android:id="@+id/image5"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:src="@drawable/image5" android:layout_toRightOf="@+id/image4"
android:layout_below="@+id/image3" android:onClick="" android:layout_alignParentBottom="true"
android:layout_alignTop="@+id/image4" android:layout_alignLeft="@+id/image2"/>
</RelativeLayout>
Последний отредактированный код:
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="horizontal"
android:weightSum="2">
<RelativeLayout android:layout_height="fill_parent"
android:layout_width="fill_parent" android:layout_weight="1"
android:id="@+id/relativeLayout1">
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical"
android:weightSum="3">
<ImageView android:id="@+id/image1" android:src="@drawable/rotating_img1"
android:layout_width="fill_parent" android:layout_height="0dip"
android:layout_below="@+id/text1view" android:scaleType="fitXY"
android:layout_weight="2"/>
<ImageView android:id="@+id/aboutklink"
android:layout_width="fill_parent" android:layout_height="0dip"
android:src="@drawable/about" android:onClick="" android:scaleType="fitXY"
android:layout_weight="1"/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout android:layout_height="fill_parent"
android:layout_width="fill_parent" android:layout_weight="1"
>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical"
android:weightSum="3">
<ImageView android:id="@+id/products"
android:layout_width="fill_parent" android:layout_height="0dip"
android:src="@drawable/products" android:onClick="" android:scaleType="fitXY"
android:layout_weight="1"/>
<ImageView android:id="@+id/productspackages"
android:layout_width="fill_parent" android:layout_height="0dip"
android:src="@drawable/special_prod" android:layout_below="@+id/products"
android:onClick="" android:scaleType="fitXY" android:layout_weight="1"/>
<ImageView android:id="@+id/events" android:layout_width="fill_parent"
android:layout_height="0dip" android:src="@drawable/events"
android:onClick="" android:scaleType="fitXY" android:layout_weight="1"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>