android - 4 imageViews in the center like 2 lines * 2 rows for all devices -
i'm trying put 4 imageviews in 2 lines * 2 rows:
i did this:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/accueil"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/font" android:src="@drawable/fond_menu" android:scaletype="centercrop" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_alignparentright="true" android:layout_alignparentend="true" /> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true"> <relativelayout android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="20dp"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/toplogo" android:layout_margintop="5dp" android:src="@drawable/logo_bleu_petit" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/toptext" android:linespacingmultiplier="1.3" android:textsize="16sp" android:layout_below="@+id/toplogo" android:layout_centerhorizontal="true" android:width="260dp" android:layout_margintop="15dp" android:gravity="center" android:textisselectable="false" android:layout_marginbottom="10dp" /> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/firstblock" android:src="@drawable/encart_offres" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_below="@+id/toptext" android:layout_alignparentright="true" android:layout_marginright="150dp" /> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/secondblock" android:src="@drawable/encart_contact" android:layout_alignparentright="true" android:layout_alignparentend="true" android:layout_below="@+id/toptext" android:layout_alignparentbottom="false" android:layout_alignparentleft="true" android:layout_alignparenttop="false" android:layout_marginleft="150dp" /> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/thirdblock" android:src="@drawable/encart_actualites" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_below="@+id/firstblock" android:layout_margintop="40dp" android:layout_marginleft="150dp" android:layout_alignparentright="true" /> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/fourthblock" android:src="@drawable/encart_mentions" android:layout_alignparentright="true" android:layout_alignparentend="true" android:layout_below="@+id/secondblock" android:layout_margintop="40dp" android:layout_marginright="150dp" android:layout_alignparentleft="true" /> <imageview android:layout_width="wrap_content" android:layout_height="80dp" android:id="@+id/formulaire" android:layout_margintop="15dp" android:layout_below="@+id/fourthblock" android:background="@drawable/bouton_formulaire" android:layout_centerhorizontal="true" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/bottomtext" android:linespacingmultiplier="1.2" android:gravity="center" android:textcolor="#626262" android:textsize="14sp" android:layout_centerhorizontal="true" android:layout_margintop="15dp" android:width="270dp" android:layout_below="@+id/formulaire" /> </relativelayout> </scrollview> </relativelayout>
but different device imageviews stick between them or overlap. think have use lines , rows, don't know how di it.
why don't use tablelayout this?
<scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/scroll"> <tablelayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <tablerow> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/toplogo1" android:layout_margintop="5dp" android:src="@drawable/logo_bleu_petit" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" /> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/toplogo2" android:layout_margintop="5dp" android:src="@drawable/logo_bleu_petit" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" /> </tablerow> <tablerow> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/toplogo3" android:layout_margintop="5dp" android:src="@drawable/logo_bleu_petit" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" /> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/toplogo4" android:layout_margintop="5dp" android:src="@drawable/logo_bleu_petit" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" /> </tablerow> </tablelayout> </scrollview>
i hope can fit question.
Comments
Post a Comment