I use RelativeLayout to post a View. Now I want to add another view, which is below the first view, and needs to be centered, referring to the first view. But there seems to be no option called something like android: layout_alignCenter .. How can I achieve this?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent" android:gravity="top">
<TextView
android:text="Blaa"
android:id="@+id/TextView1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="100dp"
android:gravity="center"
/>
<TextView
android:text="Foo"
android:id="@+id/TextView2"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_below="@+id/TextView1"
--- NEED STH THAT ALIGNS THIS SECOND VIEW CENTRAL UNDER THE FIRST VIEW --
/>
</RelativeLayout>
source
share