I want to design a Layout in which I want subtext right below main text in Android.
Pictorially something like below.
____________________________________________
|<EMP NAME > | Location | ImageView |
|<designation> | |
|________________________________|___________|
In Iphone, UITableView there is option for detaulTextLable. How can I achieve this in Android. Any Idea?
My Xml file goes like below:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:orientation="horizontal"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_below="@+id/addEmployee"
android:layout_weight="1" android:layout_height="wrap_content"
android:clickable="true" android:padding="2dip" android:layout_margin="5dip"
android:layout_marginBottom="2dip" android:layout_marginTop="2dip"
android:paddingBottom="2dip" android:background="#F5F5F5" android:fitsSystemWindows="true"
android:focusableInTouchMode="true">
<TextView android:layout_weight="1" android:id="@+id/add_employee_name"
android:clickable="true" android:layout_width="0dp" android:text="Enter Name"
android:layout_gravity="fill" android:layout_marginLeft="2dip"
android:layout_marginRight="2dip" android:layout_height="match_parent"
android:gravity="left|center" android:textStyle="bold"
android:paddingLeft="5dip" android:lineSpacingMultiplier="1.0" android:lines="3">
</TextView>
<!--
<TextView android:layout_weight="1" android:id="@+id/add_emp_designation">
</TextView>
Need to add a new text view for employees designation or textview has options for subtitles.
-->
<TextView android:layout_weight="0.4"
android:id="@+id/add_employee_location" android:clickable="true"
android:layout_width="0dp" android:text="Location" android:layout_gravity="fill"
android:layout_marginLeft="0dip" android:layout_marginRight="2dip"
android:layout_height="match_parent" android:textStyle="normal" android:paddingLeft="5dip" android:textColor="#B03060" android:gravity="bottom|right">
</TextView>
<ImageView android:id="@+id/employee_pic"
android:layout_gravity="right" android:src="@drawable/edit"
android:layout_width="wrap_content" android:layout_height="match_parent">
</ImageView>
</LinearLayout>
I am just confused how to achieve above layout. Adding a new textview adds it horizontally. Any idea?
Provided that you want the Location and ImageView to take up only just as much space as they need, the following layout will do the trick: