我怎么会在下面的布局位置图片...Android:定位图像?
|----------------------|
| |
| |
| I I |
| |
| |
| |
| |
| |
| I I |
| |
| |
------------------------
其中每个i =一个ImageView的。
我怎么会在下面的布局位置图片...Android:定位图像?
|----------------------|
| |
| |
| I I |
| |
| |
| |
| |
| |
| I I |
| |
| |
------------------------
其中每个i =一个ImageView的。
您可以使用TableLayout,RelativeLayout或嵌套的LinearLayouts。所有的图像都是相同的大小,你想让它们填满屏幕吗?
将您的主布局设置为水平。将两个新布局Layout1,Layout2添加到您的mainlayout。将它们都设置为veritcal布局。将2个图像浏览添加到layout1和2个图像浏览到layout2。
试试这个:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<ImageView android:layout_height="wrap_content" android:src="@drawable/icon"
android:id="@+id/imageView1" android:layout_width="wrap_content"
android:layout_alignParentLeft="true" android:layout_alignParentTop="true"></ImageView>
<ImageView android:layout_height="wrap_content" android:src="@drawable/icon"
android:id="@+id/imageView2" android:layout_width="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentTop="true"></ImageView>
<ImageView android:layout_height="wrap_content" android:src="@drawable/icon"
android:id="@+id/imageView3" android:layout_width="wrap_content"
android:layout_alignParentLeft="true" android:layout_alignParentBottom="true"></ImageView>
<ImageView android:layout_height="wrap_content" android:src="@drawable/icon"
android:id="@+id/imageView4" android:layout_width="wrap_content"
android:layout_alignParentRight="true" android:layout_alignParentBottom="true"></ImageView>
</RelativeLayout>
如果你想拉的图像从边缘,只是采用的Android
:layout_margin *属性个别ImageView的控制。
@ user596186:你看过GridView吗? – Squonk 2011-04-13 15:02:29