Fitting three buttons and a background image in android -
i trying develop android app should ios have done last month. there view background image , 3 buttons. background image has header part , footer part, , need 3 buttons stay between these 2 parts. screenshot ios version , desired output android activity:
and have layout file activity:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@drawable/fondo_pantalla"> > <button android:id="@+id/button2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/button1" android:drawableleft="@drawable/actividades_izq" android:text="actividades" /> <button android:id="@+id/button1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_alignparenttop="true" android:drawableleft="@drawable/agenda_izq" android:paddingtop="60dp" android:text="agenda" /> <button android:id="@+id/button3" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignparentleft="true" android:layout_below="@+id/button2" android:drawableleft="@drawable/suscribete_izq" android:text="recibir informaciĆ³n de juventud" /> </relativelayout>
i want layout looks same or similar on devices, in portrait mode.
now looks different depending on screen size.
any welcome.
i think using linear layout weight solve problem. try this.
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:weightsum="3" android:background="@drawable/ic_action_search"> <button android:id="@+id/button1" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:drawableleft="@drawable/ic_launcher" android:text="agenda" /> <button android:id="@+id/button2" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:drawableleft="@drawable/ic_action_search" android:text="actividades" /> <button android:id="@+id/button3" android:layout_width="fill_parent" android:layout_height="0dp" android:layout_weight="1" android:drawableleft="@drawable/fail" android:text="recibir informaciĆ³n de juventud" /> </linearlayout>
Comments
Post a Comment