android - Can I position a TextView based on center position of another TextView? -
i have 3 initial textviews @ top (textview1, textview2, textview3). have textview label expands across whole width of screen. below label have 3 more textviews wish position @ horizontal centre of top 3 textviews'. there can put in xml achieve this? not find appropriate constraints. find centre horizontal parent. here picture example want like:
http://i57.tinypic.com/21zq03.png
i using relative layout.
use layout_gravity -
<linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:orientation="horizontal" android:weightsum="1" > <textview android:id="@+id/text1" android:layout_width="0dp" android:layout_height="40dp" android:layout_weight="0.33" /> <textview android:id="@+id/text2" android:layout_width="0dp" android:layout_height="40dp" android:layout_weight="0.33" /> <textview android:id="@+id/text3" android:layout_width="0dp" android:layout_height="40dp" android:layout_weight="0.33" /> </linearlayout> <textview android:id="@+id/huge_text" android:layout_width="fill_parent" android:layout_height="40dp" android:layout_gravity="center_horizontal" /> <linearlayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:orientation="horizontal" android:weightsum="1" > <textview android:id="@+id/numtext1" android:layout_width="0dp" android:layout_height="40dp" android:layout_weight="0.33" /> <textview android:id="@+id/numtext2" android:layout_width="0dp" android:layout_height="40dp" android:layout_weight="0.33" /> <textview android:id="@+id/numtext3" android:layout_width="0dp" android:layout_height="40dp" android:layout_weight="0.33" /> </linearlayout>
Comments
Post a Comment