How to show image button arranged in two coloumns using ScrollView in android -



How to show image button arranged in two coloumns using ScrollView in android -

i want create xml file arrange lot of image buttons arranged in 2 coloumns

i have able create 1 colomn using linear layout in scrollview . whenever i'm trying add together linearlayout right coloumn , showing scrollview can have 1 direct kid .then how can prepare problem? here xml file :

enter code here <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent" android:fillviewport="true" android:scrollbars="none" > <linearlayout android:layout_width="wrap_content" android:layout_height="114dp" android:orientation="vertical" > <imagebutton android:id="@+id/cap_a" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentdescription="@null" android:src="@drawable/exam_a"/> <imagebutton android:id="@+id/cap_b" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentdescription="@null" android:src="@drawable/exam_b" /> <imagebutton android:id="@+id/cap_c" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentdescription="@null" android:src="@drawable/exam_c" /> <imagebutton android:id="@+id/cap_d" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentdescription="@null" android:src="@drawable/exam_d" /> <imagebutton android:id="@+id/cap_e" android:layout_width="wrap_content" android:layout_height="wrap_content" android:contentdescription="@null" android:src="@drawable/exam_e" /> <imagebutton android:id="@+id/cap_f" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_f" android:contentdescription="@null" /> <imagebutton android:id="@+id/cap_g" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_g" android:contentdescription="@null" /> <imagebutton android:id="@+id/cap_h" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_h" android:contentdescription="@null" /> <imagebutton android:id="@+id/cap_i" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_i" android:contentdescription="@null"/> <imagebutton android:id="@+id/cap_j" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_j" android:contentdescription="@null"/> <imagebutton android:id="@+id/cap_k" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_k" android:contentdescription="@null" /> <imagebutton android:id="@+id/cap_l" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_l" android:contentdescription="@null" /> <imagebutton android:id="@+id/cap_m" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_m" android:contentdescription="@null" /> <imagebutton android:id="@+id/cap_n" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_n" android:contentdescription="@null"/> <imagebutton android:id="@+id/cap_o" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_o" android:contentdescription="@null" /> <imagebutton android:id="@+id/cap_p" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_p" android:contentdescription="@null" /> <imagebutton android:id="@+id/cap_q" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_q" android:contentdescription="@null"/> <imagebutton android:id="@+id/cap_r" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_r" android:contentdescription="@null"/> <imagebutton android:id="@+id/cap_s" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_s" android:contentdescription="@null"/> <imagebutton android:id="@+id/cap_t" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_t" android:contentdescription="@null" /> <imagebutton android:id="@+id/cap_u" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_u" android:contentdescription="@null"/> <imagebutton android:id="@+id/cap_v" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_v" android:contentdescription="@null" /> <imagebutton android:id="@+id/cap_w" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_w" android:contentdescription="@null"/> <imagebutton android:id="@+id/cap_x" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_x" android:contentdescription="@null" /> <imagebutton android:id="@+id/cap_y" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_y" android:contentdescription="@null"/> <imagebutton android:id="@+id/cap_z" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/exam_z" android:contentdescription="@null"/> </linearlayout> </scrollview>

a scrollview can have 1 direct child, kid can have children. so, create kid of scrollview horizontal linearlayout, contains 2 vertical linear layouts.

<?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="match_parent" android:fillviewport="true" android:scrollbars="none" > <linearlayout android:layout_width="wrap_content" android:layout_height="114dp" android:orientation="horizontal" > <linearlayout android:layout_width="wrap_content" android:layout_height="114dp" android:orientation="vertical" > <imagebutton android:id="@+id/cap_a" .../> <imagebutton android:id="@+id/cap_b" .../> ... </linearlayout> <linearlayout android:layout_width="wrap_content" android:layout_height="114dp" android:orientation="vertical" > <imagebutton android:id="@+id/cap_a2" .../> <imagebutton android:id="@+id/cap_b2" .../> ... </linearlayout> </linearlayout> </scrollview>

android

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -