I have my layout file:
<?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="fill_parent"
android:background="#drawable/background"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/linearlayout01"
android:layout_width="300dp"
android:layout_height="45dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="52dp"
android:orientation="vertical" >
</LinearLayout>
<Button
android:id="#+id/Btn"
android:background="#drawable/close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="-2dp"
android:layout_marginTop="10dp">
</Button>
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:shrinkColumns="1"
android:stretchColumns="0"
android:layout_marginTop="15dp" >
<TableRow android:weightSum="2" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:text="#string/HostName"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_weight="0"
android:textColor="#000000"
android:textStyle="bold" />
</TableRow>
<TableRow android:weightSum="2"
android:layout_marginTop="30dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:text="#string/programname"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:id="#+id/programname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0"
android:textColor="#000000"
android:textStyle="bold" />
</TableRow>
<TableRow android:weightSum="2"
android:layout_marginTop="30dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:text="#string/Date"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0"
android:textColor="#000000"
android:textStyle="bold" />
</TableRow>
<TableRow android:layout_marginTop="20dp"
android:layout_marginLeft="1dp"
android:layout_marginRight="1dp"
>
<SeekBar
android:id="#+id/seekBar1"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/mainlayout"
android:layout_marginLeft="-260dp"
android:layout_marginRight="0dp"
android:layout_marginTop="8dp" />
</TableRow>
</TableLayout>
</LinearLayout>
and I got the following output:
Update:
But my required output should be:
| HostName: text123 |
| PName: text3 |
| Date: text6 |
Could any one help?
String, try with this. I have attached the output too. I don't get any irregular text-alignments as I have shown in the below pic.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/linearlayout01"
android:layout_width="300dp"
android:layout_height="45dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="52dp"
android:orientation="vertical" >
</LinearLayout>
<Button
android:id="#+id/Btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="-2dp"
android:layout_marginTop="10dp"
android:text="close">
</Button>
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:shrinkColumns="*"
android:stretchColumns="*"
android:layout_marginTop="15dp" >
<TableRow
android:id="#+id/tableRow1"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:weightSum="2">
<TextView
android:id="#+id/TextView04"
android:text="Date"
android:layout_width="0dp"
android:layout_weight="1"></TextView>
<TextView
android:id="#+id/TextView04"
android:text="text123"
android:textStyle="bold"
android:layout_width="0dp"
android:layout_weight="1"></TextView>
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:weightSum="2">
<TextView
android:id="#+id/TextView04"
android:text="Date"
android:layout_width="0dp"
android:layout_weight="1"></TextView>
<TextView
android:id="#+id/TextView04"
android:text="text123"
android:textStyle="bold"
android:layout_width="0dp"
android:layout_weight="1"></TextView>
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:weightSum="2">
<TextView
android:id="#+id/TextView04"
android:text="Date"
android:layout_width="0dp"
android:layout_weight="1"></TextView>
<TextView
android:id="#+id/TextView04"
android:text="text123"
android:textStyle="bold"
android:layout_width="0dp"
android:layout_weight="1"></TextView>
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:weightSum="2">
<TextView
android:id="#+id/TextView04"
android:text="Date"
android:layout_width="0dp"
android:layout_weight="1"></TextView>
<TextView
android:id="#+id/TextView04"
android:text="text123"
android:textStyle="bold"
android:layout_width="0dp"
android:layout_weight="1"></TextView>
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<SeekBar
android:id="#+id/seekBar1"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/mainlayout"
android:layout_marginLeft="-260dp"
android:layout_marginRight="0dp"
android:layout_marginTop="8dp" />
</TableRow>
</TableLayout>
</LinearLayout>
Output:
Post back if you have any issues.
Better try this ..
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:id="#+id/rows"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableLayout
android:id="#+id/key"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp" >
<TableRow
android:id="#+id/row1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="HName" />
<TextView
android:id="#+id/txt2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="HostName" />
</TableRow>
<TableRow
android:id="#+id/row2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp" >
<TextView
android:id="#+id/txt3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="PName" />
<TextView
android:id="#+id/txt4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="ProgramName" />
</TableRow>
<TableRow
android:id="#+id/row3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp" >
<TextView
android:id="#+id/txt5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Date" />
<TextView
android:id="#+id/txt6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Todays Date" />
</TableRow>
</TableLayout>
</LinearLayout>
</RelativeLayout>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:weightSum="2" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:text="Date"
android:textColor="#ffffff"
android:textStyle="bold" />
<TextView
android:id="#+id/date"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="text123"
android:textColor="#ffffff"
android:textStyle="bold" />
</TableRow>
You must give android:layout_weight for both TextView in a TableRow equally . I think it will solve your issue
EDIT :
I just give simple modifications in your xml code
<?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="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/linearlayout01"
android:layout_width="300dp"
android:layout_height="45dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="52dp"
android:orientation="vertical" >
</LinearLayout>
<Button
android:id="#+id/Btn"
android:background="#drawable/close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="-2dp"
android:layout_marginTop="10dp">
</Button>
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:shrinkColumns="1"
android:stretchColumns="0"
android:layout_marginTop="15dp" >
<TableRow android:weightSum="2" >
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:text="HostName"
android:textColor="#ffffff"
android:textStyle="bold" />
<TextView
android:id="#+id/name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:layout_weight="1"
android:text="HostName"
android:textColor="#ffffff"
android:textStyle="bold" />
</TableRow>
<TableRow android:weightSum="2"
android:layout_marginTop="30dp"
>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:text=" programname"
android:textColor="#ffffff"
android:textStyle="bold" />
<TextView
android:id="#+id/date"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text=" programname"
android:layout_weight="1"
android:textColor="#ffffff"
android:textStyle="bold" />
</TableRow>
<TableRow android:weightSum="2"
android:layout_marginTop="30dp"
>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="end"
android:text=" Date"
android:textColor="#ffffff"
android:textStyle="bold" />
<TextView
android:id="#+id/date"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text=" date"
android:layout_weight="1"
android:textColor="#ffffff"
android:textStyle="bold" />
</TableRow>
<TableRow android:layout_marginTop="20dp"
android:layout_marginLeft="1dp"
android:layout_marginRight="1dp"
>
<SeekBar
android:id="#+id/seekBar1"
android:layout_width="500dp"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/mainlayout"
android:layout_marginLeft="-260dp"
android:layout_marginRight="0dp"
android:layout_marginTop="8dp" />
</TableRow>
</TableLayout>
</LinearLayout>
Screen shot after my modification
Is this you want ??
Related
I am building an app that is in 3 languages. The problem is that the text in textview is not aligning well. See image below -
I have set the gravity to start on all textviews.
I have tried Textview issue with text align, Android: Text in TextView not aligned well, How to align the textview to right in android?
The xml is as follows -
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:background="#F2D77C"
android:orientation="vertical"
android:paddingBottom="#dimen/activity_vertical_margin"
tools:context=".AdActivity" >
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#F2D77C"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#F2D77C"
android:visibility="gone"
android:weightSum="2" >
<TextView
android:id="#+id/topCity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#F2D77C"
android:paddingBottom="7dp"
android:paddingLeft="5dp" />
<TextView
android:id="#+id/topPrice"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="top|right|end"
android:layout_weight="1"
android:background="#F2D77C"
android:paddingRight="5dp"
android:textAlignment="textEnd"
android:textSize="20sp" />
</LinearLayout>
<!--
<HorizontalScrollView
android:id="#+id/horizontalScrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
-->
<!-- </HorizontalScrollView> -->
<ImageSwitcher
android:id="#+id/imageSwitcher1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="400dp" >
</ImageSwitcher>
<Gallery
android:id="#+id/gallery1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:spacing="5dp" />
<TextView
android:id="#+id/textViewPrice"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#F2D77C"
android:padding="5dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#262626" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Ad Code"
android:textStyle="bold"
android:textSize="20sp" />
<TextView
android:id="#+id/adCode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Test code"
android:textSize="20sp" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="Viewed"
android:textStyle="bold"
android:textSize="20dp" />
<TextView
android:id="#+id/views"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="0"
android:textSize="20sp" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="4" >
<TextView
android:id="#+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:minWidth="50dp"
android:padding="5dp"
android:text="#string/city"
android:textColor="#5B554E"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/city"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="3"
android:gravity="start"
android:padding="5dp"
android:textAlignment="gravity"
android:textColor="#FFFFFFFF"
android:textSize="20sp" />
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="4" >
<TextView
android:id="#+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="5dp"
android:text="#string/date"
android:textColor="#5B554E"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/date"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:gravity="start"
android:padding="5dp"
android:textAlignment="gravity"
android:textColor="#FFFFFFFF"
android:textSize="20sp" />
</TableRow>
<TableRow
android:id="#+id/tableRow6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:weightSum="4" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:padding="5dp"
android:text="#string/price"
android:textColor="#5B554E"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/price"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3"
android:gravity="start"
android:padding="5dp"
android:textAlignment="gravity"
android:textColor="#FFFFFFFF"
android:textSize="20sp" />
</TableRow>
</TableLayout>
<TextView
android:id="#+id/textView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#20202020"
android:padding="5dp"
android:text="#string/description"
android:textColor="#6B5F53"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/description"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#F2E0A7"
android:minHeight="75dp"
android:padding="5dp"
android:paddingBottom="10dp"
android:paddingTop="10dp" />
<TextView
android:id="#+id/textView10"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#20202020"
android:padding="5dp"
android:text="#string/publisher_details"
android:textColor="#6B5F53"
android:textSize="20sp" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp" >
<TableRow
android:padding="5dp"
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView11"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="#string/name"
android:textColor="#6B5F53"
android:textStyle="bold" />
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="TextView"
android:textColor="#999999" />
</TableRow>
</TableLayout>
<Button
android:id="#+id/buttonCallCar"
style="#drawable/button_wh"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_margin="2dp"
android:background="#drawable/button_bl"
android:paddingBottom="5dp"
android:text="Call" />
<Button
android:id="#+id/buttonAltCall"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_margin="2dp"
android:background="#drawable/button_bl"
android:text="Call" />
<Button
android:id="#+id/buttonFacebook"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_margin="2dp"
android:background="#drawable/button_bl"
android:drawableLeft="#drawable/facebook"
android:text="#string/share" />
</LinearLayout>
</ScrollView>
</LinearLayout>
The problem is occurring in Kurdish and Arabic but not in English(see image for English).
I can't get the bottom row below to center, specifically the columns with integers.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/Row"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="vertical"
android:padding="10dip" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/player_profile"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dip" >
<TextView
android:id="#+id/player_number"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/player_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="1" >
<TableRow
android:id="#+id/statistics_row"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="1dip"
android:gravity="center_horizontal">
<TextView
android:id="#+id/statistic_points"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:layout_gravity="center_horizontal"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_rebounds"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:layout_gravity="center_horizontal"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_assists"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:layout_gravity="center_horizontal"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_steals"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:layout_gravity="center_horizontal"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_blocks"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:layout_gravity="center_horizontal"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_turnovers"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:layout_gravity="center_horizontal"
android:layout_weight="1" />
</TableRow>
</TableLayout>
</LinearLayout>
try this..
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/player_profile"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="5dip" >
<TextView
android:id="#+id/player_number"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/player_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="1" >
<TableRow
android:id="#+id/statistics_row"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="1dip"
android:gravity="center_horizontal">
<TextView
android:id="#+id/statistic_points"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:gravity="center_horizontal"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_rebounds"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:gravity="center_horizontal"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_assists"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:gravity="center_horizontal"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_steals"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:gravity="center_horizontal"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_blocks"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:gravity="center_horizontal"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_turnovers"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:gravity="center_horizontal"
android:layout_weight="1" />
</TableRow>
</TableLayout>
Changed android:layout_gravity="center_horizontal" to android:gravity="center_horizontal"
It's not clear which row you're unhappy with, but realize that there are 2 different gravity attributes. layout_gravity positions the view that it's defined in, while gravity positions items within that view. For layouts, it positions the views within it; for views such as TextViews it positions the text within the view.
Try that:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/player_profile"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:padding="5dip" >
<TextView
android:id="#+id/player_number"
android:layout_height="wrap_content" />
<TextView
android:id="#+id/player_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</TableRow>
</TableLayout>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="1" >
<TableRow
android:id="#+id/statistics_row"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="1dip"
android:gravity="center_horizontal">
<TextView
android:id="#+id/statistic_points"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:gravity="center"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_rebounds"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:gravity="center"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_assists"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:gravity="center"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_steals"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:gravity="center"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_blocks"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:gravity="center"
android:layout_weight="1" />
<TextView
android:id="#+id/statistic_turnovers"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:textAlignment="center"
android:gravity="center"
android:layout_weight="1" />
</TableRow>
</TableLayout>
I have a RelativeLayout with mulitple tables and as well as some headers, my problem is that I do not want entire layout to be scrollable instead of that I need to scroll only the tables.
Below is the layout:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/com.example.test"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:scrollbarSize="12dip"
android:scrollbarStyle="outsideInset"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbarAlwaysDrawHorizontalTrack="true">
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="fill_parent"
android:background="#FFFFFF"
android:layout_height="fill_parent" >
<TextView
android:id="#+id/Headerdash"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="Welcome:"
android:layout_below="#+id/tableheader"
android:layout_marginLeft="5dip"
android:textColor="#000000"
android:textSize="14dp"
android:textStyle="bold" >
</TextView>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/tableheader"
android:layout_marginTop="9dip" >
<TableRow android:gravity="right" >
<TextView
android:id="#+id/refreshmain"
android:layout_width="64dip"
android:layout_height="22dip"
android:autoLink="web"
android:background="#drawable/search_button"
android:linksClickable="true"
android:text="Refresh"
android:layout_marginRight="2dip"
android:gravity="center"
android:textColor="#FFFFFF"
android:textStyle="bold" />
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:text="|"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:id="#+id/moremain"
android:layout_width="53dip"
android:layout_height="22dip"
android:gravity="center"
android:autoLink="web"
android:background="#drawable/search_button"
android:linksClickable="true"
android:text="Home"
android:textColor="#FFFFFF"
android:textStyle="bold" />
</TableRow>
</TableLayout>
<ListView
android:id="#+id/listView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
android:layout_alignParentLeft="true"
android:layout_below="#+id/Header"
android:layout_marginLeft="20dip"
android:layout_marginTop="60dip" >
</ListView>
<TableLayout
android:id="#+id/table1"
android:layout_width="match_parent"
android:layout_height="140dip"
android:layout_below="#+id/tableheader"
android:layout_marginTop="20dip"
android:background="#drawable/shape"
android:shrinkColumns="*"
android:stretchColumns="*" >
<!-- Row 1 with single column -->
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="Vehicles"
android:textColor="#005D90"
android:textSize="18dp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="Moving"
android:textColor="#000"
android:textSize="14dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="Stopped"
android:textColor="#000"
android:textSize="14dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="Idling"
android:textColor="#000"
android:textSize="14dp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/vehicle1"
android:layout_gravity="center"
android:layout_span="3"
android:text="1"
android:textColor="#005D90"
android:textSize="35dp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:id="#+id/vehicle2"
android:text="2"
android:textColor="#005D90"
android:textSize="35dp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:id="#+id/vehicle3"
android:text="3"
android:textColor="#005D90"
android:textSize="35dp"
android:textStyle="bold" />
</TableRow>
</TableLayout>
<TableLayout
android:id="#+id/table2"
android:layout_width="match_parent"
android:layout_height="140dip"
android:layout_below="#+id/table1"
android:layout_marginTop="20dip"
android:background="#drawable/shape"
android:shrinkColumns="*"
android:stretchColumns="*" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="Speeding"
android:textColor="#005D90"
android:textSize="18dp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="<30km"
android:textColor="#000"
android:textSize="14dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text=">30-60km"
android:textColor="#000"
android:textSize="14dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text=">60km"
android:textColor="#000"
android:textSize="14dp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="1"
android:id="#+id/speeding1"
android:textColor="#005D90"
android:textSize="35dp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:id="#+id/speeding2"
android:text="2"
android:textColor="#005D90"
android:textSize="35dp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="3"
android:id="#+id/speeding3"
android:textColor="#005D90"
android:textSize="35dp"
android:textStyle="bold" />
</TableRow>
</TableLayout>
<TableLayout
android:id="#+id/table3"
android:layout_width="match_parent"
android:layout_height="140dip"
android:layout_below="#+id/table2"
android:layout_marginTop="20dip"
android:background="#drawable/shape"
android:shrinkColumns="*"
android:stretchColumns="*" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="Odometer"
android:textColor="#005D90"
android:textSize="18dp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="<1000km"
android:textColor="#000"
android:textSize="14dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text=">1000km"
android:textColor="#000"
android:textSize="14dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text=">2000km"
android:textColor="#000"
android:textSize="14dp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="1"
android:id="#+id/odometer1"
android:textSize="35dip"
android:textStyle="bold"
android:textColor="#005D90"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="2"
android:id="#+id/odometer2"
android:textStyle="bold"
android:textColor="#005D90"
android:textSize="35dp"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="3"
android:id="#+id/odometer3"
android:textStyle="bold"
android:textColor="#005D90"
android:textSize="35dp"
/>
</TableRow>
</TableLayout>
</RelativeLayout>
</ScrollView>
As per the layout above , its scrollable to entire layout , but instead of that i need to scroll only the TableLayout I created above.
Any help will be appreciated.
Use this one
<?xml version="1.0" encoding="utf-8"?>
<TextView
android:id="#+id/Headerdash"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="5dip"
android:text="Welcome:"
android:textColor="#000000"
android:textSize="14dp"
android:textStyle="bold" >
</TextView>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbarAlwaysDrawHorizontalTrack="true"
android:scrollbarAlwaysDrawVerticalTrack="true"
android:scrollbarSize="12dip"
android:scrollbarStyle="outsideInset" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TableLayout
android:id="#+id/tableheader"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="9dip" >
<TableRow android:gravity="right" >
<TextView
android:id="#+id/refreshmain"
android:layout_width="64dip"
android:layout_height="22dip"
android:layout_marginRight="2dip"
android:autoLink="web"
android:background="#drawable/ic_launcher"
android:gravity="center"
android:linksClickable="true"
android:text="Refresh"
android:textColor="#FFFFFF"
android:textStyle="bold" />
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:text="|"
android:textColor="#000000"
android:textStyle="bold" />
<TextView
android:id="#+id/moremain"
android:layout_width="53dip"
android:layout_height="22dip"
android:autoLink="web"
android:background="#drawable/ic_launcher"
android:gravity="center"
android:linksClickable="true"
android:text="Home"
android:textColor="#FFFFFF"
android:textStyle="bold" />
</TableRow>
</TableLayout>
<ListView
android:id="#+id/listView4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="#+id/Header"
android:layout_marginLeft="20dip"
android:layout_marginTop="60dip"
android:visibility="gone" >
</ListView>
<TableLayout
android:id="#+id/table1"
android:layout_width="match_parent"
android:layout_height="140dip"
android:layout_below="#+id/tableheader"
android:layout_marginTop="20dip"
android:background="#drawable/ic_launcher"
android:shrinkColumns="*"
android:stretchColumns="*" >
<!-- Row 1 with single column -->
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="Vehicles"
android:textColor="#005D90"
android:textSize="18dp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="Moving"
android:textColor="#000"
android:textSize="14dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="Stopped"
android:textColor="#000"
android:textSize="14dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="Idling"
android:textColor="#000"
android:textSize="14dp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<TextView
android:id="#+id/vehicle1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="1"
android:textColor="#005D90"
android:textSize="35dp"
android:textStyle="bold" />
<TextView
android:id="#+id/vehicle2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="2"
android:textColor="#005D90"
android:textSize="35dp"
android:textStyle="bold" />
<TextView
android:id="#+id/vehicle3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="3"
android:textColor="#005D90"
android:textSize="35dp"
android:textStyle="bold" />
</TableRow>
</TableLayout>
<TableLayout
android:id="#+id/table2"
android:layout_width="match_parent"
android:layout_height="140dip"
android:layout_below="#+id/table1"
android:layout_marginTop="20dip"
android:background="#drawable/ic_launcher"
android:shrinkColumns="*"
android:stretchColumns="*" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="Speeding"
android:textColor="#005D90"
android:textSize="18dp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="<30km"
android:textColor="#000"
android:textSize="14dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text=">30-60km"
android:textColor="#000"
android:textSize="14dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text=">60km"
android:textColor="#000"
android:textSize="14dp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<TextView
android:id="#+id/speeding1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="1"
android:textColor="#005D90"
android:textSize="35dp"
android:textStyle="bold" />
<TextView
android:id="#+id/speeding2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="2"
android:textColor="#005D90"
android:textSize="35dp"
android:textStyle="bold" />
<TextView
android:id="#+id/speeding3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="3"
android:textColor="#005D90"
android:textSize="35dp"
android:textStyle="bold" />
</TableRow>
</TableLayout>
<TableLayout
android:id="#+id/table3"
android:layout_width="match_parent"
android:layout_height="140dip"
android:layout_below="#+id/table2"
android:layout_marginTop="20dip"
android:background="#drawable/ic_launcher"
android:shrinkColumns="*"
android:stretchColumns="*" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="Odometer"
android:textColor="#005D90"
android:textSize="18dp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:gravity="center_horizontal" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="<1000km"
android:textColor="#000"
android:textSize="14dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text=">1000km"
android:textColor="#000"
android:textSize="14dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text=">2000km"
android:textColor="#000"
android:textSize="14dp" />
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal" >
<TextView
android:id="#+id/odometer1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="1"
android:textColor="#005D90"
android:textSize="35dip"
android:textStyle="bold" />
<TextView
android:id="#+id/odometer2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="2"
android:textColor="#005D90"
android:textSize="35dp"
android:textStyle="bold" />
<TextView
android:id="#+id/odometer3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_span="3"
android:text="3"
android:textColor="#005D90"
android:textSize="35dp"
android:textStyle="bold" />
</TableRow>
</TableLayout>
</LinearLayout>
</ScrollView>
I am using Datepicker in Android. I get a tottaly Bizzare UI in Jellybean.
Here is the Layout Code:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RelativeLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp" >
<TextView
android:id="#+id/textView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/stores"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/spinner_sales_store"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp" >
<TextView
android:id="#+id/textView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/products"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/spinner_sales_product"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp" >
<TextView
android:id="#+id/textView3"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/quantities"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="#+id/spinner_sales_quantity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp" >
<TextView
android:id="#+id/textView4"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/textView_sales_price"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="------"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp" >
<TextView
android:id="#+id/textView5"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="No of Items"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/txt_sales_num"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
</TableRow>
<TableRow
android:id="#+id/tableRow6a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp" >
<TextView
android:id="#+id/textView6a"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Order Date"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow6b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp" >
<android.widget.DatePicker
android:id="#+id/dpicker_sales_Order_date"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</TableRow>
<TableRow
android:id="#+id/tableRow7a"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp">
<TextView
android:id="#+id/textView7"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Issue Date"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow7b"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp" >
<android.widget.DatePicker
android:id="#+id/dpicker_sales_Issue_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="right" />
</TableRow>
<TableRow
android:id="#+id/tableRow8"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
<Button
android:id="#+id/btn_sales_save"
style="#style/ButtonStyle_menu"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:background="#drawable/custom_button"
android:text="#string/save"
android:onClick="saveClicked_Sales" />
</TableRow>
</TableLayout>
</ScrollView>
Have you experienced any such Issues?
Is there any way to show just the UI as in GingerBread?
There is no code in the Activity. Just the xml codings.
Add android:calendarViewShown="false" to your <DatePicker> element to suppress the calendar, if you do not wish to make room for it.
My textviews width is not static in my custom list view i need the size of my textview to be standard but its not working
my layout code
<?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="fill_parent"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#drawable/menuitemsgradient" >
<LinearLayout
android:id="#+id/linearLayout3"
android:layout_width="wrap_content"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/imgChkOut"
android:layout_width="60px"
android:layout_height="60px"
android:layout_margin="5dp"
android:src="#drawable/no_image" >
</ImageView>
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="center"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:orientation="vertical" >
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="" >
</TextView>
<ImageView
android:id="#+id/btn_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_margin="5dp"
android:layout_marginRight="5dp"
android:src="#drawable/btn_delete" >
</ImageView>
</TableRow>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="Name: "
android:textColor="#color/textcolorWhite" >
</TextView>
<TextView
android:id="#+id/txtName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:text="xdf "
android:textColor="#FFFFFF"
android:textSize="12sp"
android:textStyle="bold" />
</TableRow>
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="Price: "
android:textColor="#color/textcolorWhite" >
</TextView>
<TextView
android:id="#+id/txtPrice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFF"
android:textSize="12sp"
android:textStyle="bold" />
</TableRow>
<TableRow
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:layout_gravity="right"
android:text="Quantity: "
android:textColor="#color/textcolorWhite" >
</TextView>
<TextView
android:id="#+id/txtQty"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/textcolorWhite"
android:text="1"
android:textColor="#color/textColorBlack" >
</TextView>
<Button
android:id="#+id/btnPlus"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="3dp"
android:layout_marginRight="5dp"
android:background="#drawable/text_button_bg"
android:focusable="false"
android:focusableInTouchMode="false"
android:padding="5dp"
android:text="+" >
</Button>
<Button
android:id="#+id/btnMinus"
android:layout_width="30dp"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginRight="5dp"
android:background="#drawable/text_button_bg"
android:focusable="false"
android:focusableInTouchMode="false"
android:padding="5dp"
android:text="-" >
</Button>
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:text="Total: "
android:textColor="#color/textcolorWhite" >
</TextView>
<TextView
android:id="#+id/txtTotal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:textColor="#FFFFFF"
android:textSize="12sp"
android:textStyle="bold" />
</TableRow>
</TableLayout>
</LinearLayout>
</LinearLayout>
http://imageshare.web.id/viewer.php?file=4jlqbt6ge3jj5kq0omht.png
The quantity row' tetxview is working weird i dont know why ... pls help me thanks in advance
Have you tried to set android:layout_width="match_parent" on each TableRow ?
I have tried to create a small layout it will give you idea to create your layout. Maybe helpful for you.
<?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="fill_parent"
android:orientation="vertical" >
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:id="#+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:gravity="center" android:paddingRight="5dp">
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Price : "
android:textAppearance="?android:attr/textAppearanceMedium" android:singleLine="true" android:gravity="right"/>
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
</TableRow>
<TableRow
android:id="#+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:gravity="center">
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Quantity : "
android:textAppearance="?android:attr/textAppearanceMedium" android:layout_weight="1" android:gravity="right"/>
<RelativeLayout
android:id="#+id/relativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_weight="1" android:layout_gravity="center" android:gravity="center">
<TextView
android:id="#+id/textView4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="#id/button1"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" android:layout_centerVertical="true"/>
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:text="Button" android:layout_toLeftOf="#id/button2"/>
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:text="Button" />
</RelativeLayout>
</TableRow>
<TableRow
android:id="#+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
<TableRow
android:id="#+id/tableRow4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</TableRow>
</TableLayout>
</LinearLayout>