android - How to arrange some images verticaly and horizontaly -
in app have 10 images ,i arranged 2 images row wise using linear layout,i want arrange remaining images row wise (group of 2 images)under first row.i tried code ,i dont know how arrange remaining images under first row,i want add scroll view same ,is possible add single scroll view linear layouts?.i tried code not working.can me?i new android layouts.
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" tools:context="com.cozyne.user.picimagetest.gridviewactivity"> <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_vertical" android:orientation="horizontal"> <imagebutton android:id="@+id/imagebutton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/gridimg" /> <imagebutton android:id="@+id/imagebutton2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/gridimg" /> </linearlayout> <linearlayout android:layout_width="0dp" android:layout_height="wrap_content" android:gravity="start" android:orientation="vertical" android:layout_weight="1" > <imagebutton android:id="@+id/imagebutton4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/gridimg" /> <imagebutton android:id="@+id/imagebutton5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/gridimg" /> </linearlayout> </relativelayout>
use gridview or recyclerview using custom adapter intead.
http://developer.android.com/guide/topics/ui/layout/gridview.html
Comments
Post a Comment