Android images in table layout - android

I have a dynamic table layout in my Android app. Number of rows and cols may vary, but each "cell" should contain an image. What would be the proper way of populating my table with those images but scaling them so regardless of number of rows and cols they scale to perfectly fit the table and keep their aspect ration?

Why not use a Gridview for this, check the Android docs.

Hope I got you right.
Try setStretchAllColumns(true) to stretch all of your columns. So your columns fit on every number of columns.

Related

Android TableLayout Wrap Text issues

My tablelayout displays a bunch of values that are random and is created programatically.
The issue I am having is that because I don't know the content that'll be displayed on the table I am not able to use setColumnShrinkable(index, true) and therefore since the table is big, some of the columns would get cut off and not show.
I've tried playing with mTableLayout.setShrinkAllColumns(true); but that would result in columns that shouldn't shrink to shrink and thereby making the wrapping of the texts formatted poorly (see image below) and also the height of each column is too large.
I've also tried playing with minWidth of the columns but that doesn't seem to be doing anything.
What would be the best wayt to tackle this issue? Thanks!

What does android:stretchMode actually do?

I am having an issue with my gridView row height(it is not consistent, it's getting smaller as I scroll down). I was reading other question/answers here and this android:stretchMode is frequently proposed. Since I am new in gridView.
What does android:stretchMode actually do?
According to this documentation from the android developer platform,
android:stretchMode defines how columns should stretch to fill the available empty space, if any.
Must be one of the following constant values.
none Stretching is disabled.
spacingWidth: The spacing between each column is stretched.
columnWidth: Each column is stretched equally.
spacingWidthUniform: The spacing between each column is uniformly stretched..

android grid view set column width

I am having trouble controlling the size of the columns in my
GridView.
The first column is only 3-4 chars and the other 4 columns
are 5-8 chars.
For some reason, all the columns are the same width,
leaving a huge amount of spacing after the first column and wrapping
the text inside the others.
Is there a way, I can set the width of
individual columns in the grid view?
In an ideal world, gridview
would work like an html table, where the smaller columns are shrunk to
fit the data and larger columns expand as necessary.
Any ideas would
be helpful

Android, grid, three equal width columns (33%) filled with images

I try to many times without success to create grid (image gallery) which look same on all devices. Usually easy task...seems that I here miss something. To rephrase question: grid columns must fill with of device screen, images must be resized to fit width and must retain proportion.
You can use a GridView and set the columns to 3 then assign you adapter as needed.
Another option is you use a LinearLayout for each row and assign the weight of each object to .33 of the total weight.

Android TableLayout Format

So I have a table layout that Im adding rows to through code since its not a constant table or a constant amount of rows. The problem Im having is right now my last column isnt fitting all the text because the middle row is set to stretch and its taking up most the view. Is there a way to set weights for the columns so that I can have the one row be bigger than the rest but still show everything else.
The problem Im having is right now my last column isnt fitting all the text because the middle row is set to stretch and its taking up most the view.
Then either change it so the last column is the stretch column, or list both (e.g., android:stretchColumns="1,2").
Is there a way to set weights for the columns so that I can have the one row be bigger than the rest but still show everything else.
By listing more than one in android:stretchColumns, the stretching effect is applied equally to all. You can think of this as the columns having equal weight.

Categories

Resources