I've a problem in Android, that i can't solved no matter what i've tried.
Imagine a tablelayout which has 3 tablerows, and each row two textfields.
Image : Couldn't Add Image Here, Due To New User Restrictions
[Right Now Only Focus On "Showing Data"]
I need to align columns in each row equally.
(meaning : r[ 0 ]c[ 0 ].width = r[ 1]c[ 0 ].width = r[ 2 ]c[ 0 ].width etc..)
However, i've different strings in textviews, and some of them are short, some of them long.
Using 0dp as width and 1 as layout_weight values, doesn't solve my problem.
in each row (individually) columns are resized.
[See "Current Behaviour"]
Also, giving constant width values (with px or dp) makes everything constant. I don't want that either..
What i want to do is, set all textfields width in a column (in all rows) equally. According to textview which has the longest text value.
If it's not possible with tablelayout & tablerows, is it possible with listview?
How can i do this ?
Solved It! :)
For someone who will try to do this :
open table_layout in layout.xml and add :
android:shrinkColumns="*"
android:stretchColumns="*"
来源:https://stackoverflow.com/questions/13669185/keeping-columns-aligned-in-all-rows-in-an-android-table