Reputation: 9271
This question is based off my last question, Why does text view not take up the whole table row's width?. The person gave me a working solution of adding layout_weight="1" to the text view. I was thankful for that but can anyone explain why making the width match_parent(in my original code) doesn't make the text view take up the whole row's width? For layout_weight, I know that this allocates extra space so all of the extra space in the table row should be given to the textview which allows it to take up the whole row. But can't this same logic work with match_parent. Match_parent makes it so that the text view will take up the width of its parent, the table row.
Upvotes: 0
Views: 134
Reputation: 467
I'm not an expert on this, but it seems to be a problem related with the TableLayout. I found the next info about this:"The children of a TableLayout cannot specify the layout_width attribute. Width is always MATCH_PARENT." So this problem could be solved by setting the weight to the children, or programmatically like is explained here: match_parent doesn't fill parent!
Hope this helped you!
Upvotes: 1