XML layout options for Android apps interfaces

Writing the interface for an android app certainly involves a lot of XML. What’s really cool is that you can use nested layouts, which include both linear and relative layout elements… As nested as they may need to be. Check this out, for example:

<LinearLayout xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<RelativeLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp">

<TextView android:id="@+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/delButton"
android:text="Afspraken" android:textSize="36sp">

...

…And you can go ahead and nest as many within as possible. Don’t forget to close the tags correctly though!

Advertisements