XML : Putting TextViews in relative layout

I am trying to add three text views as follows, but I could not able to achieve it. I want A to be on the left side, and the other two texviews to be right side.

enter image description here

Here is what I get:

enter image description here

Here is my current implementation

  <RelativeLayout      android:id="@+id/mainlayout"      android:layout_width="match_parent"      android:layout_height="40dp"      android:paddingLeft="20dp"      android:paddingRight="20dp"      android:background="#363636">      <TextView          android:layout_alignParentLeft="true"          android:layout_width="wrap_content"          android:layout_height="wrap_content"          android:layout_centerVertical="true"          android:text="A"          android:textColor="@android:color/white"          android:paddingTop="3dp"          android:paddingBottom="3dp"          android:textSize="16sp"          android:fontFamily="sans-serif-medium" />      <RelativeLayout          android:layout_width="wrap_content"          android:layout_height="40dp"          android:layout_alignParentRight="true"          android:id="@+id/innerLayout">          <TextView              android:layout_height="wrap_content"              android:layout_width="wrap_content"              android:layout_centerVertical="true"              android:text="B "              android:textSize="16sp"              android:textColor="@android:color/white"              android:paddingRight="8dp" />          <TextView              android:layout_height="wrap_content"              android:layout_width="wrap_content"              android:layout_centerVertical="true"              android:text="C "              android:textSize="16sp"              android:textColor="@android:color/white"              android:paddingTop="3dp"              android:paddingBottom="3dp"              android:paddingLeft="8dp"              android:paddingRight="8dp" />      </RelativeLayout>  </RelativeLayout>    

No comments:

Post a Comment