I would like to create in my application statistics from a'la tiles metro. Unfortunately TextView hasn't equal width, as it solved?
Asked
Active
Viewed 67 times
0
-
As far as I have understood, the problem may be due to the fact that you have put android:layout_width="match_parent" ,try giving it a value to match your needs – Abx May 08 '13 at 08:19
-
hi Artur, welcome to the community, can you please describe more about your problem? – stinepike May 08 '13 at 08:19
-
I don't think its a good idea to mimic other UI elements like said in android design guidelines here: http://developer.android.com/design/patterns/pure-android.html – sandkasten May 08 '13 at 08:20
-
This is my layout : http://postimg.org/image/lz45maoo1/ unfortunately tiles extend depending on the length of the text with TextView – Artur Siwek May 08 '13 at 08:26
1 Answers
0
Use android:weightSum and android:layout_weight
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:weightSum="4" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="2"
android:background="#B0B0B0" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginRight="1dp"
android:layout_weight="2"
android:background="#B0B0B0" />
</TableRow>
</TableLayout>

Community
- 1
- 1

Nirav Ranpara
- 13,753
- 3
- 39
- 54