How would I position images in the following layout...
|----------------------|
| |
| |
| I I |
| |
| |
| |
| |
| |
| I I |
| |
| |
------------------------
Where each I = an imageview.
Set your main layout to horizontal. Add two new layouts, Layout1, Layout2 to your mainlayout. Set them both to veritcal layout. Add 2 imageviews to layout1 and 2 imageviews to layout2.
You can use a TableLayout, a RelativeLayout or nested LinearLayouts. Are all the images the same size and do you want them to fill the screen?
Try this:
<?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>
if you want to pull the images in from the edges, just apply android:layout_margin* attributes to the individual ImageView controls.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.