Problem with TableLayout - android

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#null">
<ImageView android:layout_width="70dip"
android:layout_height="wrap_content" android:layout_marginLeft="10dip"
android:src="#drawable/photo_profile" android:id="#+id/profil_image"
android:layout_gravity="center" android:layout_marginRight="10dip" />
<TableLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_marginLeft="15dip">
<TableRow>
<TextView android:layout_width="wrap_content" android:text="#string/experience"
android:layout_height="wrap_content" android:textStyle="bold"
android:textColor="#android:color/black" android:textSize="16sp" />
<TextView android:id="#+id/profil_experience"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textColor="#android:color/black" android:textSize="16sp" />
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content" android:text="#string/secteur"
android:layout_height="wrap_content" android:textStyle="bold"
android:textColor="#android:color/black" android:textSize="16sp" />
<TextView android:id="#+id/profil_secteur"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textColor="#android:color/black" android:textSize="16sp" />
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content" android:text="#string/lieu"
android:layout_height="wrap_content" android:textStyle="bold"
android:textColor="#android:color/black" android:textSize="16sp" />
<TextView android:id="#+id/profil_lieu"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:singleLine="false"
android:textColor="#android:color/black" android:textSize="16sp" />
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content" android:text="#string/niveau_etude"
android:layout_height="wrap_content" android:textStyle="bold"
android:textColor="#android:color/black" android:textSize="16sp" />
<TextView android:id="#+id/profil_niveau"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textColor="#android:color/black" android:textSize="16sp" />
</TableRow>
<TableRow>
<TextView android:layout_width="wrap_content" android:text="#string/entreprise"
android:layout_height="wrap_content" android:textStyle="bold"
android:textColor="#android:color/black" android:textSize="16sp" />
<TextView android:id="#+id/profil_societe"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:textColor="#android:color/black" android:textSize="16sp" />
</TableRow>
</TableLayout>
<CheckBox android:layout_height="wrap_content" android:id="#+id/profil_checkbox"
android:layout_width="wrap_content" android:layout_gravity="center_vertical" />
</LinearLayout>
and i got this :
http://img11.hostingpics.net/pics/819091Capture.png
I have two problems :
* I can't see the Checkbox
* The text is cutted
and thank you for your attention

You don't have any text in your checkbox. Try adding a text="Some Text" to see if it shows up. I'm guessing since you have it set to wrap_content, you don't actually have any content to wrap.

You can use your TableLayout in a ScrollView of fixed height.so bottom area can be used for CheckBox.

Related

col and row spans in android table layout android

I want to make following layout in android but unable to make because i new to table layout and tried a lot to fix column spans and row spans.
This is what i had tried last, but the problem is the heading in first column, i want a row span of 2 but unable to do that so i put another blank row there.
<LinearLayout
android:id="#+id/fillable_area"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal">
<TableLayout
android:id="#+id/fixed_column_table"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_gravity="center_horizontal"
android:padding="2dp"
android:text="Account"
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="12sp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_gravity="center_horizontal"
android:padding="2dp"
android:text=""
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="12sp"
android:textStyle="bold" />
</TableRow>
</TableLayout>
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="5dp">
<TableLayout
android:id="#+id/scrollable_table"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stretchColumns="*">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_gravity="center_horizontal"
android:layout_span="2"
android:padding="2dp"
android:paddingStart="10dp"
android:text="Opening Balance"
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:layout_gravity="center_horizontal"
android:layout_span="2"
android:padding="2dp"
android:paddingStart="10dp"
android:text="Transaction During Period"
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:layout_gravity="center_horizontal"
android:layout_span="2"
android:padding="2dp"
android:paddingStart="10dp"
android:text="Closing Balance"
android:textAlignment="center"
android:textColor="#color/black"
android:textSize="12sp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:background="#FFC7C7"
android:padding="2dp"
android:paddingStart="10dp"
android:text="Debit"
android:textAlignment="textEnd"
android:textColor="#color/black"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:background="#FBFFC7"
android:padding="2dp"
android:paddingStart="10dp"
android:text="Credit"
android:textAlignment="textEnd"
android:textColor="#color/black"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:background="#FFC7C7"
android:padding="2dp"
android:paddingStart="10dp"
android:text="Debit"
android:textAlignment="textEnd"
android:textColor="#color/black"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:background="#FBFFC7"
android:padding="2dp"
android:paddingStart="10dp"
android:text="Credit"
android:textAlignment="textEnd"
android:textColor="#color/black"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:background="#FFC7C7"
android:padding="2dp"
android:paddingStart="10dp"
android:text="Debit"
android:textAlignment="textEnd"
android:textColor="#color/black"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:background="#FBFFC7"
android:padding="2dp"
android:paddingStart="10dp"
android:text="Credit"
android:textAlignment="textEnd"
android:textColor="#color/black"
android:textSize="12sp"
android:textStyle="bold" />
</TableRow>
</TableLayout>
</HorizontalScrollView>
</LinearLayout>
Data in all rows are dynamic except headings.
Please help me.
Thanks

Layout does not work in portrait mode

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dip" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:padding="1dip" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="20dp"
android:text="Total Pregnancies"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="30dp"
android:text="10"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="160dp"
android:text="Full Term"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="75dp"
android:text="11"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="190dp"
android:text="Premature"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="30dp"
android:text="12"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/linearLayout1"
android:layout_below="#+id/linearLayout1"
android:layout_marginTop="35dp"
android:padding="1dip" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="20dp"
android:text="Multiples"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="85dp"
android:text="16"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="160dp"
android:text="Living"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="95dp"
android:text="17"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/linearLayout1"
android:layout_centerVertical="true"
android:padding="1dip" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="20dp"
android:text="Ab Included"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="70dp"
android:text="13"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="160dp"
android:text="Ab Spontaneous"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="30dp"
android:text="14"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="190dp"
android:text="Ectopics"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="35dp"
android:text="15"
android:textColor="#000000" />
</LinearLayout>
</RelativeLayout>
Can anyone tell me whats wrong with this layout as it seems not working in portrait mode, but perfectly fits the screen when it comes to landscape. I have attached the screen shot of what i am trying to do, the above is a lists which is added to a ListView.
Update:
The View gets gets cluttered when in portrait mode.
There are some problems with what you've written:
You assume that the width would suffice no matter what is the screen . You might want to add a horizontalScrollView or use a different layout.
You have the same id for each of the layouts.
Why do you have android:orientation="vertical" for your RelativeLayout?
All the LinearLayouts have the same id linearLayout1. I think you should give different ids to different views.

Achieving the same result without paddingLeft property

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dip" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:padding="1dip" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="20dp"
android:text="Total Pregnancies"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="30dp"
android:text="10"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="160dp"
android:text="Full Term"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="75dp"
android:text="11"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="190dp"
android:text="Premature"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="30dp"
android:text="12"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/linearLayout1"
android:layout_below="#+id/linearLayout1"
android:layout_marginTop="35dp"
android:padding="1dip" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="20dp"
android:text="Multiples"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="85dp"
android:text="16"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="160dp"
android:text="Living"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="95dp"
android:text="17"
android:textColor="#000000" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/linearLayout1"
android:layout_centerVertical="true"
android:padding="1dip" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="20dp"
android:text="Ab Included"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="70dp"
android:text="13"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="160dp"
android:text="Ab Spontaneous"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="30dp"
android:text="14"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="190dp"
android:text="Ectopics"
android:textColor="#000000" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="35dp"
android:text="15"
android:textColor="#000000" />
</LinearLayout>
</RelativeLayout>
This is how the screen looks, can anyone tell me how can i achieve this layout. i have come up with the layout, but it seems it does not fit for all screens.
Make the LinearLayout width fill_parent to use the entire width of the screen.
Then for each TextView, set the layout_width to 0dp, and set layout_weight to the proportion of the screen you want that view to have.
In the padding, specify the minimum amount you want between the different cells.
For example, if you want the text to occupy double the space of the numbers, use the following code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dip" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dip"
android:padding="1dip" >
<TextView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:text="Total Pregnancies"
android:textColor="#000000" />
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:text="10"
android:textColor="#000000" />
<TextView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:text="Full Term"
android:textColor="#000000" />
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:text="11"
android:textColor="#000000" />
<TextView
android:layout_width="0dp"
android:layout_weight="2"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:text="Premature"
android:textColor="#000000" />
<TextView
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:gravity="left"
android:paddingLeft="5dp"
android:text="12"
android:textColor="#000000" />
</LinearLayout>
</RelativeLayout>
Use TableLayout
Here is an example

Distorted layout getting generated from XML in Android

I'm using this layout in one of my applications. I don't know why it is getting distorted. The main issue is that in all the three LinearLayout blocks, only the first TextView is displayed on the screen and in place of the TextViews following that, a big blank space is displayed.
The snapshot of the image being displayed is Snapshot...
Layout.xml
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="5sp" >
<LinearLayout
android:id="#+id/ll_images"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:orientation="vertical"
android:padding="10sp" >
<ImageView
android:id="#+id/certification_image"
android:layout_width="100sp"
android:layout_height="wrap_content"
android:contentDescription="#string/details_image"
android:visibility="gone" />
<ImageView
android:id="#+id/image_details_page"
android:layout_width="100sp"
android:layout_height="100sp"
android:contentDescription="#string/details_image" />
</LinearLayout>
<TextView
android:id="#+id/details_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="#id/ll_images"
android:padding="10sp"
android:textColor="#040404"
android:textSize="25sp"
android:textStyle="bold"
android:typeface="sans" />
<TextView
android:id="#+id/details_tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#id/details_name"
android:layout_toLeftOf="#id/ll_images"
android:paddingLeft="5sp"
android:textColor="#343434"
android:textSize="15sp"
android:typeface="sans" />
<LinearLayout
android:id="#+id/ll_facts"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/ll_images">
<TextView
android:id="#+id/tv_facts"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/gradient_bg"
android:padding="10sp"
android:text="Facts"
android:textColor="#android:color/darker_gray"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/details_tv2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5sp"
android:textSize="15sp"
android:text="#string/test" />
<TextView
android:id="#+id/details_tv3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5sp"
android:text="#string/test"
android:textSize="15sp" />
<TextView
android:id="#+id/details_tv4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5sp"
android:text="#string/test"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/ll_foundation"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/ll_facts">
<TextView
android:id="#+id/tv_foundation"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/gradient_bg"
android:padding="10sp"
android:text="Foundation Statement"
android:textColor="#android:color/darker_gray"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/details_tv5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5sp"
android:textColor="#343434"
android:text="#string/test"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/ll_overview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/ll_foundation">
<TextView
android:id="#+id/tv_overview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/gradient_bg"
android:padding="10sp"
android:text="Overview"
android:textColor="#android:color/darker_gray"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/details_tv6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/test"
android:paddingLeft="5sp"
android:textColor="#343434"
android:textSize="15sp" />
</LinearLayout>
<Button
android:id="#+id/btnViewScorecard"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#id/ll_overview"
android:layout_margin="5sp"
android:background="#drawable/search_button"
android:paddingLeft="10sp"
android:text="#string/ViewScorecard"
android:textColor="#FFFFFF"
android:typeface="sans"
android:visibility="gone"/>
</RelativeLayout>
Any help would be really appreciated. Thanks in advance!!!
You forget about
xmlns:android="http://schemas.android.com/apk/res/android"
Just change
<RelativeLayout
to
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
Finally I have figured it out... All I had to do was I had to add the following line to my LinearLayout.
android:orientation="vertical"
Thanks all for the help...

How to increase width of particular EditText in Table Raw (Table layout)

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>

Categories

Resources