I need to draw a horizontal line below a text field such that the width of the line equals the text width (not the width of the full screen).
In my app I have a textview below a view(Horizontal line).
The width of the line view should be equal to the width of the textview.
I tried android:layout_width="wrap_content" and "match_parent", which does not solve the problem.
This is xml coding sample:
......
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="28dp"
android:text="PopUpWindow"
android:textAppearance="?android:attr/textAppearanceLarge" />
<View
android:id="@+id/separator"
android:layout_width="wrap_content"
android:layout_height="0.3dp"
android:layout_below="@+id/textView1"
android:background="#ffffff" />
......
image of the screen is:
please help me.
question from:
https://stackoverflow.com/questions/9977721/how-to-set-width-which-is-equal-to-another-widget-on-android 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…