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
Related
I am very new to xamarin.andriod, I am trying to design a table with many rows. Everything is fine but I am not able to get a separator properly for rows.
Here is my code:
<TableLayout
android:layout_margin="10dp"
android:minWidth="25px"
android:minHeight="50px"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/tableLayout1"
android:layout_gravity="center"
android:showDividers="middle"
android:stretchColumns="*"
>
<TableRow
android:background="#D3D3D3"
android:id="#+id/tableHeader1"
android:maxLines="1"
android:ellipsize="end"
android:maxEms="3"
android:singleLine="true"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:paddingTop="1dp"
android:paddingLeft="1dp"
android:paddingRight="1dp"
android:paddingBottom="1dp"
android:gravity="center">
<TextView
android:text="UserName"
android:textColor="#343434"
android:id="#+id/username"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:gravity="center" />
<TextView
android:text="UserName"
android:textColor="#343434"
android:id="#+id/username1"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:gravity="center" />
<TextView
android:text="UserName"
android:textColor="#343434"
android:id="#+id/username2"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:gravity="center" />
<TextView
android:text="UserName"
android:textColor="#343434"
android:id="#+id/username3"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:gravity="center" />
<TextView
android:text="!"
android:textColor="#343434"
android:id="#+id/rowNotFilledIndication"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:gravity="center"
android:visibility="invisible"
android:tag="RowIncomplete" />
<TextView
android:text="UserName"
android:textColor="#343434"
android:id="#+id/username4"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:gravity="center" />
<TextView
android:text="UserName"
android:textColor="#343434"
android:id="#+id/username5"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<TextView
android:text="UserName"
android:textColor="#343434"
android:id="#+id/username3"
android:layout_gravity="center"
android:layout_height="wrap_content"
android:gravity="center" />
</TableRow>
</TableLayout>
And here is the output I am getting
But I just want a ending line for each row completion instead of two lines for the row.
Is there any way to get only one line after the row completion?
try to use a view, make sure you set your show:divider to none
<View
android:id="#+id/view"
android:layout_width="match_parent"
android:layout_height="2dp"
android:background="#color/colorPrimary"
/>
When I am try to develop a simple table layout it's occur a problem. The layout is works fine for big screen. But when I'm use that in small phone then the problem create. The full rows aren't visible.
Can anyone help me out? I just want to make a simple table layout like that:
here what I made xml layout
<TableLayout
android:layout_below="#+id/jonosonkha"
android:layout_width="match_parent"
android:layout_height="250dp"
android:stretchColumns="5">
<TableRow>
<TextView
android:textColor="#000"
android:background="#ffea00"
android:textSize="20sp"
android:text="পরিবার"
android:paddingLeft="5dp" />
<TextView
android:background="#000"
android:textColor="#fff"
android:textSize="20sp"
android:text="পুরুষ"
android:gravity="left"
android:paddingLeft="5dp"/>
<TextView
android:background="#ffea00"
android:textSize="20sp"
android:text="মহিলা"
android:textColor="#000"
android:gravity="center"
android:paddingLeft="5dp" />
<TextView
android:background="#000"
android:textSize="20sp"
android:text="গড় সদস্য"
android:gravity="left"
android:textColor="#fff"
android:paddingLeft="5dp" />
<TextView
android:background="#ffea00"
android:textColor="#000"
android:textSize="20sp"
android:text="ঘনত্ব/কি.মি"
android:gravity="left"
android:paddingLeft="5dp" />
</TableRow>
<TableRow
android:layout_marginTop="2dp"
>
<TextView
android:textColor="#000"
android:background="#ffea00"
android:textSize="16sp"
android:text="৮৯৮৬৩"
android:paddingLeft="5dp" />
<TextView
android:background="#000"
android:textColor="#fff"
android:textSize="16sp"
android:text="২০৫০৭৫"
android:gravity="center"
android:paddingLeft="5dp"/>
<TextView
android:background="#ffea00"
android:textSize="16sp"
android:text="২০৯১১৩"
android:textColor="#000"
android:gravity="center"
android:paddingLeft="5dp" />
<TextView
android:background="#000"
android:textSize="16sp"
android:text="৪.৫৪"
android:gravity="center"
android:textColor="#fff"
android:paddingLeft="5dp" />
<TextView
android:background="#ffea00"
android:textColor="#000"
android:textSize="16sp"
android:text="২১৩৮"
android:gravity="left"
android:paddingLeft="5dp" />
</TableRow>
</TableLayout>
It's works fine for big screen but the problem is some of rows are covered by the small screen. Any solution please.
You want to divide five TextView .
You can add android:layout_width="0dp" 、android:layout_height="match_parent" and android:layout_weight="1" in your TextView .
You can try this .
<TableLayout
android:layout_width="match_parent"
android:layout_height="250dp"
android:layout_below="#+id/jonosonkha"
android:stretchColumns="5">
<TableRow>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffea00"
android:paddingLeft="5dp"
android:text="পরিবার"
android:textColor="#000"
android:textSize="20sp"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000"
android:gravity="left"
android:paddingLeft="5dp"
android:text="পুরুষ"
android:textColor="#fff"
android:textSize="20sp"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffea00"
android:gravity="center"
android:paddingLeft="5dp"
android:text="মহিলা"
android:textColor="#000"
android:textSize="20sp"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000"
android:gravity="left"
android:paddingLeft="5dp"
android:text="গড় সদস্য"
android:textColor="#fff"
android:textSize="20sp"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffea00"
android:gravity="left"
android:paddingLeft="5dp"
android:text="ঘনত্ব/কি.মি"
android:textColor="#000"
android:textSize="20sp"/>
</TableRow>
<TableRow
android:layout_marginTop="2dp">
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffea00"
android:paddingLeft="5dp"
android:text="৮৯৮৬৩"
android:textColor="#000"
android:textSize="16sp"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000"
android:gravity="center"
android:paddingLeft="5dp"
android:text="২০৫০৭৫"
android:textColor="#fff"
android:textSize="16sp"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffea00"
android:gravity="center"
android:paddingLeft="5dp"
android:text="২০৯১১৩"
android:textColor="#000"
android:textSize="16sp"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000"
android:gravity="center"
android:paddingLeft="5dp"
android:text="৪.৫৪"
android:textColor="#fff"
android:textSize="16sp"/>
<TextView
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#ffea00"
android:gravity="left"
android:paddingLeft="5dp"
android:text="২১৩৮"
android:textColor="#000"
android:textSize="16sp"/>
</TableRow>
</TableLayout>
Output
You should define the width attribute of the table rows, like:
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
and the weight attribute of all the Textviews:
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="#000"
android:background="#ffea00"
android:textSize="20sp"
android:text="পরিবার"
android:paddingLeft="5dp" />
I am using this code, but the center column is having more width than others. i tried removing rows, it seems the problem is row2 & row4. but there is no padding or margin but still its not proper.
<!-- title row 1 -->
<TableRow>
<TextView
android:id="#+id/timeLabletv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="3dp"
android:text="#string/tr_time_spend"
android:textColor="#FFFFFF"
android:textSize="8sp"
android:textStyle="bold" />
<TextView
android:id="#+id/focusLabletv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="3dp"
android:text="#string/tr_focus"
android:textColor="#FFFFFF"
android:textSize="8sp"
android:textStyle="bold" />
<TextView
android:id="#+id/caloriesLabel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="3dp"
android:text="#string/tr_calories"
android:textColor="#FFFFFF"
android:textSize="8sp"
android:textStyle="bold" />
</TableRow>
<!-- data row 1 -->
<TableRow>
<TextView
android:id="#+id/timeSpenttv"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:text="8.00M"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/focusValuetv"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:text="#string/tr_focus_balance"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/caloriestv"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:text="#string/tr_calories_def"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold" />
</TableRow>
<!-- title row 2 -->
<TableRow>
<TextView
android:id="#+id/setsLabletv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="3dp"
android:text="#string/tr_sets"
android:textColor="#FFFFFF"
android:textSize="8sp"
android:textStyle="bold" />
<TextView
android:id="#+id/repetitionsLabletv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="3dp"
android:text="#string/tr_reps"
android:textColor="#FFFFFF"
android:textSize="8sp"
android:textStyle="bold" />
<TextView
android:id="#+id/kilosLabel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="3dp"
android:text="#string/tr_kilos"
android:textColor="#FFFFFF"
android:textSize="8sp"
android:textStyle="bold" />
</TableRow>
<!-- data row 2 -->
<TableRow>
<TextView
android:id="#+id/setsValuetv"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:text="#string/tr_sets_def"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/repetitionsValuetv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:text="#string/tr_reps_def"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/kilostv"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:text="#string/tr_kilos_def"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold" />
</TableRow>
</TableLayout>
it looks like this:
You can set the field widths to 0 and the weights to "1" and it sets all three columns to equal widths. Like this:
<TableRow>
<TextView
android:id="#+id/timeLabletv"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="3dp"
android:text="#string/tr_time_spend"
android:textColor="#ffffff"
android:textSize="8sp"
android:textStyle="bold" />
<TextView
android:id="#+id/focusLabletv"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="3dp"
android:text="#string/tr_focus"
android:textColor="#ffffff"
android:textSize="8sp"
android:textStyle="bold" />
<TextView
android:id="#+id/caloriesLabel"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="3dp"
android:text="#string/tr_calories"
android:textColor="#ffffff"
android:textSize="8sp"
android:textStyle="bold" />
</TableRow>
<!-- data row 1 -->
<TableRow>
<TextView
android:id="#+id/timeSpenttv"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="fill_parent"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:text="8.00M"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/focusValuetv"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="fill_parent"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:text="#string/tr_focus_balance"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/caloriestv"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="fill_parent"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:text="#string/tr_calories_def"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold" />
</TableRow>
<!-- title row 2 -->
<TableRow>
<TextView
android:id="#+id/setsLabletv"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="3dp"
android:text="#string/tr_sets"
android:textColor="#ffffff"
android:textSize="8sp"
android:textStyle="bold" />
<TextView
android:id="#+id/repetitionsLabletv"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="3dp"
android:text="#string/tr_reps"
android:textColor="#ffffff"
android:textSize="8sp"
android:textStyle="bold" />
<TextView
android:id="#+id/kilosLabel"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginTop="3dp"
android:text="#string/tr_kilos"
android:textColor="#ffffff"
android:textSize="8sp"
android:textStyle="bold" />
</TableRow>
<!-- data row 2 -->
<TableRow>
<TextView
android:id="#+id/setsValuetv"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="fill_parent"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:text="#string/tr_sets_def"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/repetitionsValuetv"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:text="#string/tr_reps_def"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold" />
<TextView
android:id="#+id/kilostv"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="fill_parent"
android:layout_marginBottom="3dp"
android:layout_marginTop="3dp"
android:text="#string/tr_kilos_def"
android:textColor="#000000"
android:textSize="24sp"
android:textStyle="bold" />
</TableRow>
</TableLayout>
I have a ListView with 10 columns and an header. As you can see in the following picture, the rows are not aligned with the header.
If the text in the TextViews was centered it seems like the problem would solve.
I tried many things, but none of them worked.
*NOTE: Please don't tell me to use a TableLayout. I already did it but the loading was much slower.
Here is the xml of the ListView:
<ListView
android:id="#+id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#id/LinearLayout1"
android:background="#d9d9d9" >
</ListView>
Here is the list_header xml:
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/TableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/header_back"
android:orientation="horizontal" >
<TextView
android:id="#+id/stockNumTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:text="#string/stockNum"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="16sp" />
<TextView
android:id="#+id/shapeTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:text="#string/shape"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="16sp" />
<TextView
android:id="#+id/weightTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:text="#string/weight"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="16sp" />
<TextView
android:id="#+id/colorTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:text="#string/color"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="16sp" />
<TextView
android:id="#+id/clarityTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:text="#string/clarity"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="16sp" />
<TextView
android:id="#+id/cutGradeTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:text="#string/cutGrade"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="16sp" />
<TextView
android:id="#+id/labTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:text="#string/labb"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="16sp" />
<TextView
android:id="#+id/priceTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:text="#string/price"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="16sp" />
<TextView
android:id="#+id/discountTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="1"
android:text="#string/disc"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="16sp" />
<TextView
android:id="#+id/statusTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="#string/status"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textSize="16sp" />
</TableRow>
Here is the list_item xml:
<TableRow xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/TableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/list_item_selector"
android:clickable="true"
android:orientation="horizontal" >
<TextView
android:id="#+id/stockNumTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:layout_weight="1"
android:text="#string/stockNum"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="14sp" />
<TextView
android:id="#+id/shapeTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:layout_weight="1"
android:text="#string/shape"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="14sp" />
<TextView
android:id="#+id/weightTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:layout_weight="1"
android:text="#string/weight"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="14sp" />
<TextView
android:id="#+id/colorTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:layout_weight="1"
android:text="#string/color"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="14sp" />
<TextView
android:id="#+id/clarityTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:layout_weight="1"
android:text="#string/clarity"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="14sp" />
<TextView
android:id="#+id/cutGradeTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:layout_weight="1"
android:text="#string/cutGrade"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="14sp" />
<TextView
android:id="#+id/labTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:layout_weight="1"
android:text="#string/lab"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="14sp" />
<TextView
android:id="#+id/priceTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:layout_weight="1"
android:text="#string/price"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="14sp" />
<TextView
android:id="#+id/discountTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:layout_weight="1"
android:text="#string/disc"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#android:color/black"
android:textSize="14sp" />
<TextView
android:id="#+id/statusTxt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp"
android:layout_weight="1"
android:text="#string/status"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#color/red"
android:textSize="14sp" />
</TableRow>
Thank you!
make textsizes the same for both header and items- you ddi 14sp for items and 16sp for header, and also remove margin from items, if the issue still keep same, put margin/padding to list items
<?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.