I have a table layout with a button in its lowest row:
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/name" >
</TextView>
<EditText
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left" >
</EditText>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/frist_name" >
</TextView>
<EditText
android:id="#+id/firstName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left" >
</EditText>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/telephone" >
</TextView>
<EditText
android:id="#+id/telephone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left" >
</EditText>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/userName" >
</TextView>
<EditText
android:id="#+id/userName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left" >
</EditText>
</TableRow>
<TableRow>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/password" >
</TextView>
<EditText
android:id="#+id/password"
android:inputType="textPassword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left" >
</EditText>
</TableRow>
<TableRow>
<Button
android:id="#+id/saveMasterDataButton"
android:text="#string/save"
android:layout_gravity="center_horizontal|fill_horizontal"
android:textAllCaps="false"
android:visibility="visible"
android:gravity="left|center_vertical|center_horizontal" />
</TableRow>
My Problem ist that the button is always by default out of alignment with the text content in the same column above it by 1 or 2 mm to the right. I fiddled around with various tricks, removing the shade, but the results where never satisfactory.
Here is how this button looks like:Save button out of alignment
Thanks
Matthias
Related
I have a textview wrapped in a table row.
The contents of the Textview may take up multiple lines so I am want to make the textview scrollable but with no success.
I have tried via XML and programmatically:
<TableRow
android:id="#+id/tableRow5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/tvTable_Refeeral_Center"
android:layout_width="110dp"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#drawable/cell_shaoe"
android:textAppearance="?android:attr/textAppearanceMedium" >
</TextView>
<TextView
android:id="#+id/tvTable_Referral_Center_Input"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_weight="2"
android:background="#drawable/cell_shaoe"
android:maxLines="2"
android:scrollbars = "vertical"
android:typeface="sans"
android:ems="10"
android:hint="Hours "
android:textColor="#c4c4c4"
android:padding="5dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
And in my class I set the movement method of the textview:
referralLabTV.setMovementMethod(ScrollingMovementMethod.getInstance());
I have also tried by wrapping the textview in a scrollview but also does not work:
<TableRow
android:id="#+id/tableRow6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/tvTable_RefRanges"
android:layout_width="110dp"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#drawable/cell_shaoe"
android:padding="5dp"
android:typeface="sans"
android:text="Ref Ranges"
android:textColor="#FFFFFF"
android:textAppearance="?android:attr/textAppearanceMedium" >
</TextView>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2"
android:background="#drawable/cell_shaoe"
>
<TextView
android:id="#+id/tvrefRanges_Input"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:maxLines="6"
android:typeface="sans"
android:ems="10"
android:hint="Ref Range"
android:textColor="#c4c4c4"
android:padding="5dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
</ScrollView>
</TableRow>
Any input appreciated.
#Shagar
I tried your solution but still the same, can olnlt see first line of text that is added from database to the textview programmatically. This is the entire Linear/table layout
TableLayout
android:id="#+id/testSelcted_tabl"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/tv_selectedTest_Section2"
android:layout_marginTop="20dp"
android:layout_marginRight="10dp"
android:layout_marginLeft="5dp"
android:shrinkColumns="1"
>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/tvTable_TAT"
android:layout_width="110dp"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#drawable/cell_shaoe"
android:padding="5dp"
android:typeface="sans"
android:text="TAT (hrs)"
android:textColor="#FFFFFF"
android:textAppearance="?android:attr/textAppearanceMedium" >
</TextView>
<TextView
android:id="#+id/tvTable_TATText"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_weight="2"
android:background="#drawable/cell_shaoe"
android:maxLines="2"
android:scrollbars = "vertical"
android:typeface="sans"
android:ems="10"
android:text="Contact Referral Lab"
android:textColor="#c4c4c4"
android:padding="5dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/tvTable_Fixation"
android:layout_width="110dp"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#drawable/cell_shaoe"
android:padding="5dp"
android:typeface="sans"
android:text="Fixation"
android:textColor="#FFFFFF"
android:textAppearance="?android:attr/textAppearanceMedium" >
</TextView>
<TextView
android:id="#+id/tvTFixation_Input"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_weight="2"
android:background="#drawable/cell_shaoe"
android:typeface="sans"
android:ems="10"
android:hint="Histology"
android:textColor="#c4c4c4"
android:padding="5dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/tvTable_TATUrgent"
android:layout_width="110dp"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#drawable/cell_shaoe"
android:padding="5dp"
android:typeface="sans"
android:text="Urgent"
android:textColor="#FFFFFF"
android:textAppearance="?android:attr/textAppearanceMedium" >
</TextView>
<TextView
android:id="#+id/tvTable_TATUrgetInput"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_weight="2"
android:background="#drawable/cell_shaoe"
android:typeface="sans"
android:ems="10"
android:hint="Hours "
android:padding="5dp"
android:textColor="#c4c4c4"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/tvTable_Refeeral_Center"
android:layout_width="110dp"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#drawable/cell_shaoe"
android:padding="5dp"
android:typeface="sans"
android:text="Referral Lab"
android:textColor="#FFFFFF"
android:textAppearance="?android:attr/textAppearanceMedium" >
</TextView>
<TextView
android:id="#+id/tvTable_Referral_Center_Input"
android:layout_width="wrap_content"
android:layout_height="50dp"
android:layout_weight="2"
android:background="#drawable/cell_shaoe"
android:maxLines="2"
android:scrollbars = "vertical"
android:typeface="sans"
android:ems="10"
android:hint="Hours "
android:textColor="#c4c4c4"
android:padding="5dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow6"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="3" >
<TextView
android:id="#+id/tvTable_RefRanges"
android:layout_width="110dp"
android:layout_height="50dp"
android:layout_weight="1"
android:background="#drawable/cell_shaoe"
android:padding="5dp"
android:typeface="sans"
android:text="Ref Ranges"
android:textColor="#FFFFFF"
android:textAppearance="?android:attr/textAppearanceMedium" >
</TextView>
<!-- wrap a linear layout in a scroll voew which wraps the textview fro textview to scroll -->
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2"
android:background="#drawable/cell_shaoe"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/tvrefRanges_Input"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxLines="1"
android:typeface="sans"
android:ems="10"
android:hint="Ref Range"
android:textColor="#c4c4c4"
android:padding="5dp"
android:text="jwwhegfrhegihsighhgishgifhwihgawihrgaiwhgihigheihgraiehrgiher"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</ScrollView>
</TableRow>
</TableLayout>
Simply put a LinearLayout inside of your ScrollView.
and make your TextView height witdh matched to its parent.
here is the modified code.
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="2"
android:background="#android:color/holo_blue_light"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/tvrefRanges_Input"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxLines="6"
android:typeface="sans"
android:ems="10"
android:hint="Ref Range"
android:textColor="#c4c4c4"
android:padding="5dp"
android:text="Hello\nHello\nHello\nHello\nHello\nHello\nHello\n"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</ScrollView>
The only way I could do this is change textview to a editview with attributes:
android:editable="false"
android:cursorVisible="false"
As shown in the image i want to reduce the gap between two rows (marked by red color) so that my edit text appears just below the text.
My code
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dip" >
<TextView
android:id="#+id/textView1"
android:text="#string/projectName"
android:textSize="16sp"
android:textAppearance="#string/projectName"
android:textColor="#color/text_color"/>
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dip">
<EditText
android:id="#+id/editText"
android:layout_width="0dp"
android:layout_height="35dp"
android:inputType="text"
android:singleLine="true"
android:background="#drawable/editbox_background_normal"
android:layout_weight="1"
android:padding="5dip"
/>
</TableRow>
</TableLayout>
Get rid of all those paddings
android:padding="2dip"
android:padding="5dip"
You can use padding left and right instead.
Try this
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView
android:id="#+id/textView1"
android:text="#string/projectName"
android:textSize="16sp"
android:textAppearance="#string/projectName"
android:textColor="#color/text_color"/>
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<EditText
android:id="#+id/editText"
android:layout_width="0dp"
android:layout_height="35dp"
android:inputType="text"
android:singleLine="true"
android:background="#drawable/editbox_background_normal"
android:layout_weight="1"
/>
</TableRow>
</TableLayout>
Buddy try this,it must help you
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dip"
android:layout_marginBottom="10dp">
<TextView
android:id="#+id/textView1"
android:text="#string/projectName"
android:textSize="16sp"
android:textAppearance="#string/projectName"
android:textColor="#color/text_color"/>
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="2dip"
android:layout_marginTop="10dp">
<EditText
android:id="#+id/editText"
android:layout_width="0dp"
android:layout_height="35dp"
android:inputType="text"
android:singleLine="true"
android:background="#drawable/editbox_background_normal"
android:layout_weight="1"
android:padding="5dip"
/>
</TableRow>
</TableLayout>
I am using Table layout. I have two(columns) text-views in table row. I want to apply android:ellipsize="end" at the end of the textView.
But it is not working for me, see the screen shot below. Please give me any idea, how to apply ellipsize to the textview inside a table row.
Here is the code :
<TableLayout
android:id="#+id/linerLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="10dip"
android:background="#drawable/shape1"
android:stretchColumns="2" >
<TableRow
android:id="#+id/TableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Product used for "
android:textColor="#color/black_color" />
<TextView
android:id="#+id/productusedfor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:minLines="1"
android:padding="5dp"
android:singleLine="true"
android:text="TextView"
android:textColor="#color/black_color" />
</TableRow>
<TableRow
android:id="#+id/TableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Treatment for "
android:textColor="#color/black_color" />
<TextView
android:id="#+id/treatementfor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:minLines="1"
android:padding="5dp"
android:singleLine="true"
android:text="TextView"
android:textColor="#color/black_color" />
</TableRow>
<TableRow
android:id="#+id/TableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Horse Name "
android:textColor="#color/black_color" />
<TextView
android:id="#+id/horsename"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:ellipsize="end"
android:minLines="1"
android:padding="5dp"
android:singleLine="true"
android:text="TextView"
android:textColor="#color/black_color" />
</TableRow>
<TableRow
android:id="#+id/TableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Where "
android:textColor="#color/black_color" />
<TextView
android:id="#+id/location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:minLines="1"
android:padding="5dp"
android:singleLine="true"
android:text="TextView"
android:textColor="#color/black_color" />
</TableRow>
Try this
You have to use following property. Because textview width is wrap_content so it is going outside from the tablerow. So if you use this property then it will work: android:layout_weight="1".
<TableLayout
android:id="#+id/linerLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="10dip"
android:background="#drawable/shape1"
android:stretchColumns="2" >
<TableRow
android:id="#+id/TableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Product used for "
android:textColor="#color/black_color" />
<TextView
android:id="#+id/productusedfor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:minLines="1"
android:layout_weight="1"
android:padding="5dp"
android:singleLine="true"
android:text="fjdsngfksngfkfngkaklmngkldfmnkldgfnskldngkldnsklnghdnklgfnkdtgfndkgfn"
android:textColor="#color/black_color" />
</TableRow>
<TableRow
android:id="#+id/TableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Treatment for "
android:textColor="#color/black_color" />
<TextView
android:id="#+id/treatementfor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:minLines="1"
android:layout_weight="1"
android:padding="5dp"
android:singleLine="true"
android:text="TextView"
android:textColor="#color/black_color" />
</TableRow>
<TableRow
android:id="#+id/TableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Horse Name "
android:textColor="#color/black_color" />
<TextView
android:id="#+id/horsename"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:ellipsize="end"
android:minLines="1"
android:layout_weight="1"
android:padding="5dp"
android:singleLine="true"
android:text="TextView"
android:textColor="#color/black_color" />
</TableRow>
<TableRow
android:id="#+id/TableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Where "
android:textColor="#color/black_color" />
<TextView
android:id="#+id/location"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:minLines="1"
android:layout_weight="1"
android:padding="5dp"
android:singleLine="true"
android:text="TextView"
android:textColor="#color/black_color" />
</TableRow>
</TableLayout>
It may work for you.
//try this
android:maxEms="9" this attributes will do change you maxEms according to your length what you want to achive.
<TextView
android:id="#+id/productusedfor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:minLines="1"
android:padding="5dp"
android:maxEms="5"
android:singleLine="true"
android:text="TextView"
android:textColor="#color/black_color" />
For a multiline TextViews I use android:maxLines="3" in every TextView that needs ellipsize.
I am using Table Layout.
Here i have three EditText's with same width ="200dp".
But i want to increase the size of 3rd EditText.
I made its width="wrap_content" but all other EditText also getting "wrap_content"
How can i increase the width of 3rd EditText with out affecting other EditText's.
This code for 3rd EditText:-
<TableRow
android:gravity="center_horizontal"
android:layout_marginBottom="10dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left"
android:id="#+id/addl"
android:text="Address"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:id="#+id/colon"
android:text=":" />
<EditText
android:layout_width="250dp"
android:layout_marginLeft="20dp"
android:id="#+id/et"
android:singleLine="true"/>
</TableRow>
Now i want to increase width of Address EditText only
i think you can achieve this by layout_weight parameter of EditTexts like below
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/relativeLayout12"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#909090"
android:padding="10dp" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Student ID"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text=":"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="6" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text=":"
android:textColor="#000000" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Class"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text=":"
android:textColor="#000000" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Address"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text=":"
android:textColor="#000000" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
</TableRow>
</TableLayout>
EDIT
This is the outcome
put the property android:stretchColumns="2" in TableLayout
<TableLayout android:stretchColumns="2" ... > .... </TableLayout>
In my android project I want a textfield of type personname where by default caps lock is activated, however, this code isn't working.
<EditText
android:id="#+id/txt_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName" >
<requestFocus />
</EditText>
Why might this not work?
EDIT: here is the xml code to show what the file is
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/t_registration"
android:textSize="25dp"
android:textStyle="bold"
android:paddingTop="7dp"
android:paddingBottom="7dp"/>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:stretchColumns="1" >
<TableRow
android:id="#+id/tableRow0"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/lbl_user_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.0"
android:text="User Name * : " />
<EditText
android:id="#+id/txt_user_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName" >
<requestFocus />
</EditText>
</TableRow>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/lbl_first_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.0"
android:text="First Name * : " />
<EditText
android:id="#+id/txt_first_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:drawable/editbox_background"
android:inputType="textPersonName" >
</EditText>
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/lbl_last_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.0"
android:text="Last Name * : " />
<EditText
android:id="#+id/txt_last_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:drawable/editbox_background"
android:inputType="textPersonName" >
</EditText>
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/lbl_email_address"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.0"
android:text="Email Address: " />
<EditText
android:id="#+id/txt_email_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:drawable/editbox_background"
android:inputType="textEmailAddress" >
</EditText>
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/lbl_school_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.0"
android:text="school_id * : " />
<EditText
android:id="#+id/txt_school_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:drawable/editbox_background"
android:inputType="text" >
</EditText>
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/lbl_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.0"
android:text="Password * : " />
<EditText
android:id="#+id/txt_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:drawable/editbox_background"
android:inputType="textPassword" >
</EditText>
</TableRow>
<TableRow
android:id="#+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/lbl_confirm_password"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.0"
android:text="Confirm password * : " />
<EditText
android:id="#+id/txt_password2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#android:drawable/editbox_background"
android:inputType="textPassword" >"
</EditText>
</TableRow>
<TableRow
android:id="#+id/tableRow7"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/lbl_image_select"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="0.0"
android:text="Image Select * : " />
<Button
android:id="#+id/b_image_browse"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_margin="1dp"
android:padding="10dp"
android:text="#string/b_image_browse"
android:textSize="15dp"
android:onClick="b_image_browse_action" />
</TableRow>
</TableLayout>
<EditText
android:id="#+id/txt_image_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Image File Path"
android:inputType="text" >
</EditText>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<Button
android:id="#+id/b_reg_Cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="10dp"
android:layout_marginLeft="30dp"
android:padding="10dp"
android:text="#string/b_reg_Cancel"
android:textSize="15dp"
android:onClick="b_reg_Cancel_action" />
<Button
android:id="#+id/b_reg_Submit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_margin="10dp"
android:layout_marginRight="100dp"
android:padding="10dp"
android:text="#string/b_reg_Submit"
android:textSize="15dp"
android:onClick="b_reg_Submit_action"/>
</RelativeLayout>
</LinearLayout>
Use
android:inputType="textPersonName|textCapWords"
as using only "textPersonName" is not enough so name's first letters would be capitalized.
Similarly with postal addresses:
android:inputType="textPostalAddress|textCapSentences"
If you try to display person name as normal, try this: android:capitalize="words". If you want to all caps you can change words into characters or doing like Mr. LuxuryMode said!
Edited:
You should remove android:inputType="textPersonName" field. It will work!
I used this for the caps words and no suggestion
android:inputType="textCapWords|textNoSuggestions"
e.g. Tom Hanks
If you want all caps, just use android:textAllCaps="true"