-1

I am using Table Layout to display data as shown below. enter image description here

What i want to do ?

I want to align all content to the largest content. As you can see on the below picture Pilot column has the largest content. I mean what it should look like; enter image description here

Code:

<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:shrinkColumns="*"
android:stretchColumns="*" >

<TableRow
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <others.TypefaceTextView
        android:id="@+id/txtNo"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="1"
        app:customTypeface="fonts/RobotoCondensed-Light.ttf" />

    <others.TypefaceTextView
        android:id="@+id/txtKapi"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="1"
        app:customTypeface="fonts/RobotoCondensed-Light.ttf" />

    <others.TypefaceTextView
        android:id="@+id/txtPilotad"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:maxWidth="115dp"
        android:minWidth="100dp"
        android:text="Y.AVCI"
        app:customTypeface="fonts/RobotoCondensed-Light.ttf" />

    <others.TypefaceTextView
        android:id="@+id/txtSinif"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="S2"
        app:customTypeface="fonts/RobotoCondensed-Light.ttf" />

    <others.TypefaceTextView
        android:id="@+id/txtZaman"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="17:45:5"
        app:customTypeface="fonts/RobotoCondensed-Light.ttf" />

    <others.TypefaceTextView
        android:id="@+id/txtFark"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="17:45:5"
        app:customTypeface="fonts/RobotoCondensed-Light.ttf" />

    <others.TypefaceTextView
        android:id="@+id/txtOndeki"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="17:45:5"
        app:customTypeface="fonts/RobotoCondensed-Light.ttf" />
</TableRow>

Swisyn
  • 397
  • 1
  • 6
  • 11

1 Answers1

1

I think I know what you are trying to do. Try giving all the value a weight so they stay in the same area. You may have to play with the weight values to meet your needs.

Eugene H
  • 3,520
  • 3
  • 22
  • 39
  • Try taking a look at this for an example of your needs. http://stackoverflow.com/a/4568183/3904085 – Eugene H Aug 07 '14 at 23:59
  • Thank you so much for help! I've solved my problem with weight attribute. I've known using weight but didn't know that i can give dynamic values for rows' itself. Here is the result after given weight values; http://oi57.tinypic.com/2dh9wqr.jpg http://pastebin.com/KrZCtZC3 – Swisyn Aug 08 '14 at 09:29
  • 1
    Very nice. It looks great. Glad it helped. – Eugene H Aug 08 '14 at 14:35