unable to fit text in TableRow in android - android

I am quite new to android and i am designing a Table layout with every row containing two textviews.The problem is that the text in textview gets truncated if text is long.I have used wrap content and applied weight also but not help me .The code for layout is below
<TableLayout
android:id="#+id/tableLayout"
style="#style/fill_parent_wrap_content" >
<TableRow style="#style/both_wrap_content" >
<TextView
style="#style/InfoTextView1"
android:text="#string/customerName"
android:textStyle="bold" />
<TextView
android:id="#+id/txtDetailCustomerName"
style="#style/InfoTextView1" />
</TableRow>
<TableRow style="#style/both_wrap_content" >
<TextView
style="#style/InfoTextView1"
android:text="#string/caNumberDetail"
android:textStyle="bold" />
<TextView
android:id="#+id/txtDetailCaNo"
style="#style/InfoTextView1" />
</TableRow>
<TableRow style="#style/both_wrap_content" >
<TextView
style="#style/InfoTextView1"
android:text="#string/customerAddress"
android:textStyle="bold" />
<TextView
android:id="#+id/txtDetailAddress"
style="#style/InfoTextView1"
/>
</TableRow>
</TableLayout>
</Scrollview>
This is a style that i apply to textviews
<style name="InfoTextView1">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginLeft">5dp</item>
<item name="android:paddingTop">15dp</item>
<item name="android:textColor">#color/Black</item>
<item name="android:textSize">#dimen/text_size_small</item>
</style>

Try this..
<TableRow
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:weightSum="2">
<TextView
android:layout_height="50dp"
android:layout_width="0dp"
android:layout_weight="1"
android:singleLine="true"
android:ellipsize="marquee"/>
<TextView
android:layout_height="50dp"
android:layout_width="0dp"
android:layout_weight="1"
android:singleLine="true"
android:ellipsize="marquee"/>
</TableRow>
Then put this line in java file textview.setSelected(true);

Show the style for the TableLayout and TableRows...
I bet the problem is on them.

Related

View in ConstraintLayout does not fit within screen bounds

I'm trying to align 3 TableLayouts within a ConstraintLayout. I want the table with the MaterialButtons to have 1:1 dimension ratio, while the table on the top and on start still completely remains within the bounds of the screen. This is what it currently looks like:
The definition of this TableLayout:
<TableLayout
android:id="#+id/play_field_table"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="#id/play_field_row_values_table"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.7">
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton style="#style/field_unpainted" />
...
<com.google.android.material.button.MaterialButton style="#style/field_unpainted" />
</TableRow>
...
</TableLayout>
The definition of the button's style:
<style name="field_unpainted" parent="Widget.MaterialComponents.Button.OutlinedButton">
<item name="android:layout_margin">0dp</item>
<item name="android:padding">0dp</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
<item name="android:insetTop">0dp</item>
<item name="android:insetBottom">0dp</item>
<item name="android:textAlignment">center</item>
<item name="android:textStyle">bold</item>
<item name="android:backgroundTint">#ffffff</item>
<item name="android:strokeColor">#000000</item>
<item name="cornerFamily">cut</item>
<item name="cornerRadius">0dp</item>
</style>
The definition of the TableLayout on the start:
<TableLayout
android:id="#+id/play_field_row_values_table"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_marginLeft="8dp"
app:layout_constraintBottom_toBottomOf="#+id/play_field_table"
app:layout_constraintEnd_toStartOf="#+id/play_field_table"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#+id/play_field_table">
<TableRow
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="end|center_vertical"
android:text="1 1"
android:textAlignment="gravity"
android:textColor="#color/black" />
</TableRow>
...
</TableLayout>
This is the definition of the TableLayout on the top:
<TableLayout
android:id="#+id/play_field_column_values_table"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toTopOf="#+id/play_field_table"
app:layout_constraintEnd_toEndOf="#+id/play_field_table"
app:layout_constraintStart_toStartOf="#+id/play_field_table">
<TableRow
android:layout_width="0dp"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_weight="1"
android:gravity="center_horizontal|bottom"
android:text="1"
android:textAlignment="gravity"
android:textColor="#color/black" />
...
</TableRow>
...
</TableLayout>
I've tried setting the layout_constraintDimensionRatio to 1:1 on the "id/play_field_table", but then it stretches out of the screen:
Also tried setting the layout_constraintDimensionRatio to 1:1 in the button style, but then the buttons either are just not displayed or the same result as above.
I feel like the ratios should be both set for the buttons and for the table, just can't figure out correct combinations. Any advice?
I managed to fix the issue by setting the following values for the "#+id/play_field_table" TableLayout:
Changed "layout_height" from "wrap_content" to "0dp" value
Added "layout_constraintDimensionRatio" with "1:1" value
Added "layout_weight" with "1" value to the TableRows inside the TableLayout

android Separator after last item of ListView

I have two listviews and two different adapters for them. one shows the bottom divider but the other list does not show divider after the last item.
The one which shows divider after last item, only has listview in the layout. other one which does not shows divider has other views along with the listview.
both listviews have the same style which is below.
<style name="st_comman_data_list">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">match_parent</item>
<item name="android:background">#color/app_background_color</item>
<item name="android:cacheColorHint">#color/app_background_color</item>
<item name="android:drawSelectorOnTop">true</item>
<item name="android:fadeScrollbars">true</item>
<item name="android:fadingEdge">none</item>
<item name="android:focusableInTouchMode">true</item>
<item name="android:listSelector">#drawable/list_states_color</item>
<item name="android:scrollbarFadeDuration">1000</item>
<item name="android:fastScrollEnabled">true</item>
</style>
Edit
layout xml for correct divider
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/app_background_color_light"
android:orientation="vertical" >
<ListView
android:id="#+id/gift_home_ui_home_list"
style="#style/st_comman_data_list"
android:layout_height="match_parent" />
xml which don't shows divider
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#color/app_background_color"
android:cacheColorHint="#color/app_background_color"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#drawable/background_header"
android:gravity="center"
android:visibility="gone" >
<Button
android:id="#+id/tab_video_main_btn_all"
style="#style/st_btn_top_header_gry"
android:layout_marginRight="2dp"
android:text="#string/st_tab_main_btn_all" />
<Button
android:id="#+id/tab_video_main_btn_my_videos"
style="#style/st_btn_top_header_gry"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:text="#string/st_tab_video_main_btn_my_videos"
android:visibility="visible" />
<Button
android:id="#+id/tab_video_main_btn_saved"
style="#style/st_btn_top_header_gry"
android:layout_marginLeft="2dp"
android:text="#string/st_tab_main_btn_saved" />
</LinearLayout>
<View style="#style/st_single_black_line" />
<TableLayout
android:id="#+id/video_search_holder"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#drawable/background_header_small"
android:focusableInTouchMode="false"
android:gravity="left"
android:stretchColumns="0"
android:visibility="gone" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:layout_margin="#dimen/margin_basic_very_large"
android:background="#drawable/audio_search_bg"
android:gravity="left|center_vertical"
android:paddingLeft="#dimen/padding_basic_2dp"
android:paddingRight="#dimen/padding_basic_2dp" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical" >
<ImageButton
android:id="#+id/video_btn_search_clear"
style="#style/st_search_ui_ic_search"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"
android:src="#drawable/ic_clear_search"
android:visibility="gone" />
<ImageButton
android:id="#+id/video_btn_search"
style="#style/st_search_ui_ic_search"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="#drawable/ic_search" />
<EditText
android:id="#+id/video_search_edit_text"
style="#style/st_search_ui_search_bar"
android:layout_toLeftOf="#id/video_btn_search_clear"
android:layout_toRightOf="#id/video_btn_search"
android:focusable="false"
android:focusableInTouchMode="false"
android:hint="#string/hint_search_by_video_title_or_description"
android:imeOptions="actionDone"
android:singleLine="true"
android:windowSoftInputMode="stateVisible|adjustResize" />
</RelativeLayout>
</TableRow>
</TableLayout>
<ListView
android:id="#+id/no_more_text_list"
style="#style/st_no_more_text_list"
android:visibility="gone" />
<ListView
android:id="#+id/video_chanel_list"
style="#style/st_comman_data_list" />
<View
android:id="#+id/invisible"
android:layout_width="match_parent"
android:layout_height="1dp" />
Solutions which i have tried:
set height as "match_parent"
add a view under the list view and make it invisible
set footer divider as enabled (which is true by default)
Someone have any ides why it is behaving differently?

TextView does not show all the text

I have a Ui which shows customer information. The problem I have is some customer name(android:id="#+id/customerName") is long and does not fit in the textview. what option i ahev to beable to display them other then the option to give full layout width to the name or removing the code textview from next to it(as seen in the xml file android:id="#+id/customerName").
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="*" >
<TableRow>
<TextView
style="#style/CustomerLabelTextView"
android:gravity="right"
android:text="#string/customerCode" />
<TextView
style="#style/CustomerLabelTextView"
android:gravity="right"
android:text="#string/customerName" />
</TableRow>
<TableRow>
<TextView
android:id="#+id/customerCode"
style="#style/CustomerTextView"
android:gravity="right" />
<TextView
android:id="#+id/customerName"
style="#style/CustomerTextView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:gravity="right"
android:maxEms="5" />
</TableRow>
<TableRow android:gravity="right" >
<TextView
style="#style/CustomerLabelTextView"
android:gravity="right"
android:text="#string/customerAddress" />
</TableRow>
<TableRow android:gravity="right" >
<TextView
android:id="#+id/customerAddress"
style="#style/CustomerTextView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"
android:gravity="right"
android:maxEms="5"
/>
</TableRow>
<TableRow>
<TextView
style="#style/CustomerLabelTextView"
android:gravity="right"
android:text="#string/POBox" />
<TextView
style="#style/CustomerLabelTextView"
android:gravity="right"
android:text="#string/OrganizationName" />
</TableRow>
<TableRow>
<TextView
android:id="#+id/poBox"
style="#style/CustomerTextView"
android:gravity="right" />
<TextView
android:id="#+id/organizationName"
style="#style/CustomerTextView"
android:gravity="right" />
</TableRow>
<TableRow>
<TextView
style="#style/CustomerLabelTextView"
android:gravity="right"
android:text="#string/fax" />
<TextView
style="#style/CustomerLabelTextView"
android:gravity="right"
android:text="#string/phone" />
</TableRow>
====================================STYLE++++++++++++++++++++++++++++++++++++++++
<style name="CustomerTextView">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">#android:color/white</item>
<item name="android:layout_margin">5dp</item>
<item name="android:background">#drawable/textview_border</item>
I fixed it by using
android:layout_height="wrap_content"
android:inputType="textMultiLine"
hope this works for you too.
One option is to make it ellipsize, so if a name is 'Really Long Name", it might show up as "Really Lon...". To do this:
android:ellipsize="end"
android:singleLine="true"
On the other hand, you can make the textview change size to fit the text using:
android:layout_width="wrap_content"
But I'm not sure if it'll work with everything else you're trying to do (eg fill_parent and width inside a tablerow)
remove the android:maxEms="5" line in xml file and than try
You can make the TextView expand to a second line by setting singleLine attribute to false.
<TextView
android:singleLine="false"
/>
You can try and make the textview scrollable so that when the data to display is too much,scrolling will reveal the hidden text.
In the xml file,change LinearLayout to ScrollView layout.

ImageView expands when displaying an image

I'm trying to make a layout with 10 equal height rows, each row containing an ImageView and a TextView. When I put an image into the ImageView, I would like it scaled to retain the same aspect and fit inside the ImageView, not changing the ImageView size or the height of the containing TableRow.
The problem I have is that when I load an image into the ImageView, the ImageView seems to expand, and it also changes the height of the TableRow (?) I've been looking at this for a while, but can't seem to get it to work. It's possible I have missed one of the details of how Android layout or an ImageView works (?)
I've created a smaller example from my code which exhibits the problem. I've also set the background color on the ImageView so it is easier to see it change size.
Below are my layout files and code (apologies for the formatting, I have also put the complete Eclipse project at http://dl.dropbox.com/u/28937795/ImageRowSample.zip)
Any help would be appreciated. =)
MAIN.XML
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TableRow style="#style/SlashRowStyle">
<ImageView style="#style/SlashViewStyle" />
<TextView style="#style/NumberViewStyle" android:text="0" />
</TableRow>
<TableRow style="#style/SlashRowStyle">
<ImageView style="#style/SlashViewStyle" />
<TextView style="#style/NumberViewStyle" android:text="1" />
</TableRow>
<TableRow style="#style/SlashRowStyle">
<!-- I'm setting the background of this ImageView
so it's easier to see it change size -->
<ImageView android:id="#+id/image2" style="#style/SlashViewStyle"
android:background="#FF0000"/>
<TextView style="#style/NumberViewStyle" android:text="2" />
</TableRow>
<TableRow style="#style/SlashRowStyle">
<ImageView style="#style/SlashViewStyle" />
<TextView style="#style/NumberViewStyle" android:text="3" />
</TableRow>
<TableRow style="#style/SlashRowStyle">
<ImageView style="#style/SlashViewStyle" />
<TextView style="#style/NumberViewStyle" android:text="4" />
</TableRow>
<TableRow style="#style/SlashRowStyle">
<ImageView style="#style/SlashViewStyle" />
<TextView style="#style/NumberViewStyle" android:text="5" />
</TableRow>
<TableRow style="#style/SlashRowStyle">
<ImageView style="#style/SlashViewStyle" />
<TextView style="#style/NumberViewStyle" android:text="6" />
</TableRow>
<TableRow style="#style/SlashRowStyle">
<ImageView style="#style/SlashViewStyle" />
<TextView style="#style/NumberViewStyle" android:text="7" />
</TableRow>
<TableRow style="#style/SlashRowStyle">
<ImageView style="#style/SlashViewStyle" />
<TextView style="#style/NumberViewStyle" android:text="8" />
</TableRow>
<TableRow style="#style/SlashRowStyle">
<ImageView style="#style/SlashViewStyle" />
<TextView style="#style/NumberViewStyle" android:text="9" />
</TableRow>
<LinearLayout style="#style/ButtonBarStyle" >
<Button android:text="Add Image" android:onClick="onClickedAddImage"
android:gravity="center" android:layout_width="0dip"
android:layout_height="fill_parent" android:layout_weight="1" />
<Button android:text="Clear Image" android:onClick="onClickedClearImage"
android:gravity="center" android:layout_width="0dip"
android:layout_height="fill_parent" android:layout_weight="1" />
</LinearLayout>
</TableLayout>
.
STYLES.XML
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="SlashRowStyle" >
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">0dip</item>
<item name="android:layout_weight">1</item>
<item name="android:gravity">center</item>
</style>
<style name="SlashViewStyle" >
<!-- I want scaling so it fits in the Imageview with the same aspect.
I tried both fitCenter and centerInside -->
<item name="android:scaleType">fitCenter</item>
<item name="android:layout_width">0dip</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_weight">40</item>
<item name="android:gravity">center</item>
</style>
<style name="NumberViewStyle">
<item name="android:layout_width">0dip</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:layout_weight">60</item>
<item name="android:gravity">center</item>
<item name="android:typeface">sans</item>
<item name="android:textStyle">bold</item>
<item name="android:textSize">20sp</item>
<item name="android:textColor">#0000FF</item>
</style>
<style name="ButtonBarStyle">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:orientation">horizontal</item>
<item name="android:background">#404040</item>
<item name="android:paddingTop">5dip</item>
</style>
</resources>
.
IMAGEROWSAMPLEACTIVITY.JAVA
public class ImageRowSampleActivity extends Activity {
private ImageView _iv;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
_iv = (ImageView)findViewById(R.id.image2);
}
public void onClickedAddImage(View v) {
_iv.setImageResource(R.drawable.x);
}
public void onClickedClearImage(View v) {
//_iv.setImageResource(0); //Tried this also
_iv.setImageDrawable(null);
}
}
After looking at it some more I finally stumbled onto the answer.
The problem is the TableRows in the TableLayout. The Android SDK TableLayout doc says that
The children of a TableLayout cannot specify the layout_width attribute. Width is always
MATCH_PARENT. However, the layout_height attribute can be defined by a child; default value
is WRAP_CONTENT. If the child is a TableRow, then the height is always WRAP_CONTENT.
The TableRow doc also says
The children of a TableRow do not need to specify the layout_width and layout_height
attributes in the XML file. TableRow always enforces those values to be respectively
MATCH_PARENT and WRAP_CONTENT.
So, yeah, the problem was the TableRows always ignoring my settings and making their heights WRAP_CONTENT, then also forcing the ImageView's height to be WRAP_CONTENT. When I converted the TableLayout and TableRows to LinearLayouts with the correct orientations, everything worked as I originally expected...

2-column TableLayout with 50% exactly for each column

This one puzzles me since my first steps with Android. I can't make both columns in a 2-column TableLayout exact 50% each.
Here's an example:
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="fill_parent" >
<TableLayout
android:id="#+id/tablelayout"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:paddingRight="2dip" >
<TableRow>
<TextView
style="#style/TextViewStandard"
android_layout_span="2"
android:layout_weight="1"
android:text="Bla" />
</TableRow>
<TableRow>
<TextView
style="#style/TextViewStandard"
android:layout_weight="1"
android:text="Name:" />
<EditText
style="#style/EditTextStandard"
android:id="#+id/et_name"
android:layout_weight="1" />
</TableRow>
<TableRow>
<TextView
style="#style/TextViewStandard"
android:layout_weight="1"
android:text="URL:" />
<EditText
style="#style/EditTextStandard"
android:id="#+id/et_url"
android:layout_weight="1" />
</TableRow>
<TableRow>
<Button
style="#style/ButtonStandard"
android:layout_column="0"
android:layout_marginTop="6dip"
android:onClick="onClickOk"
android:text="#android:string/ok" />
</TableRow>
</TableLayout>
</ScrollView>
And here's the corresponding style definition:
<resources>
<style name="ButtonStandard" parent="#android:style/Widget.Button">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_width">fill_parent</item>
</style>
<style name="EditTextStandard" parent="#android:style/Widget.EditText">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginLeft">2dip</item>
<item name="android:layout_marginRight">2dip</item>
<item name="android:layout_marginTop">2dip</item>
<item name="android:layout_width">fill_parent</item>
</style>
<style name="TextViewStandard" parent="#android:style/Widget.TextView">
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginLeft">2dip</item>
<item name="android:layout_marginRight">2dip</item>
<item name="android:layout_marginTop">2dip</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:textColor">#android:color/white</item>
</style>
</resources>
This becomes really messed up with a CheckBox involved.
What's wrong with my definition?
Many thanks in advance.
HJW
Have you tried to set the android:layout_width attribute to 0dp (and of course keep the android:layout_weight as 1) on the child views?
I have been in similar scenarios when I also wanted to distribute the given space equally between two child views but failed to do so since the child with "wider content" also became wider, within its parent, than its sibling. This was due to the fact that the wider child had a greater initial width. Making sure both children started of from the same width (android:layout_width="0dp" on both of them) also guaranteed to distribute the space evenly among them.
This is how I format my tables evenly. Not part of your question but to span all columns android:layout_span="2" on other TableRow children that do not contain the android:layout_column attribute. Hope this helps.
<TableLayout
android:id="#+id/tableLayout1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="0,1">
<TableRow
android:id="#+id/tableRow1"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/textView1"
android:layout_column="0">
</TextView>
<TextView
android:id="#+id/textView2"
android:layout_column="1">
</TextView>
</TableRow>
</TableLayout>
I would create a table layout
Inside a frame layout holding your control. In this example I have two columns layout and I put two ImageView's centered in each column.
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<TableRow>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/button_wedding_day_cheat_sheet"
android:id="#+id/buttonWeddingDayCheatSheet"
android:onClick="onClickWeddingDayCheatSheet"
android:layout_gravity="center_horizontal">
</ImageView>
</FrameLayout>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="0dp"
android:layout_weight="1">
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/button_share_favorite_recipe"
android:id="#+id/buttonShareFavoriteRecipe"
android:onClick="onClickShareFavoriteRecipe"
android:layout_gravity="center_horizontal">
</ImageView>
</FrameLayout>
</TableRow>
</TableLayout>
The columns in the android table always adjust to the widest view which in any row. There are no explicit controls here of the columns. Grid view has more control of the column size such as: android:columnWidth="100dp"
If the left and righ view in the table would be set to the same size then a centered table could have two 50% spaced columns.

Categories

Resources