Tag Archives: relativelayout

1,230 views

Center View in RelativeLayout Android

RelativeLayout like parent, child Srollview is centered horizontal. Second RelativeLayout in SrollView have gravity center, every child will centered horizontally and vertically. <?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" android:gravity="center_horizontal">   <ScrollView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/scrollView2" >   <RelativeLayout android:layout_width="320dp" android:layout_height="wrap_content" … Continue reading

Posted in Android Examples Code | Tagged | Comments Off on Center View in RelativeLayout Android
5,551 views

Relative layout RelativeLayout Android example

xml RelativeLayout Android example: Eclipse graphical xml layout editor res/layout/main.xml <?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"> <TextView android:id="@+id/idLabel" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Enter word"/> <EditText android:id="@+id/idEntry" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:drawable/editbox_background" android:layout_below="@id/idLabel"/> <Button android:id="@+id/idOk" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/idEntry" android:layout_alignParentRight="true" android:layout_marginLeft="10dip" android:text="OK" /> <Button android:layout_width="wrap_content" … Continue reading

Posted in Android Examples Code | Tagged , , , , | Comments Off on Relative layout RelativeLayout Android example