Als Teil einer größeren Benutzeroberfläche habe ich eine RelativeLayout
mit drei Ansichten, die ich möchte, um die gleiche Breite zu haben. Die drei Ansichten sind "gestapelt" auf der jeweils anderen wie dieseWie man mehrere Ansichten die gleiche Breite bildet?
ImageView
TextView
ImageView
ich verschiedene Dinge wie Einstellung der View
s'versucht haben android:layout_width
zu "wrap_content", setzen Sie android:layout_width
auf "0px" und android:layout_weight
auf "1", wie von this answer vorgeschlagen, und setzen Sie die View
s in eine LinearLayout
ohne Erfolg.
Wie kann ich diese drei Ansichten die gleiche Breite erhalten?
Relevante Teil des XML-Layout:
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0px"
android:layout_weight="1">
<ImageView
android:layout_above="@string/window_text"
android:layout_below="@string/eighteen_id"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:paddingTop="5dp"
android:layout_alignParentRight="true"
android:paddingBottom="5dp"
android:src="@drawable/line1"
android:id="@string/line_1_id"/>
<TextView
android:layout_above="@string/line_2_id"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:gravity="right"
android:layout_centerVertical="true"
android:textColor="#000000"
android:id="@string/window_text"/>
<ImageView
android:layout_above="@string/top_row_id"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_alignParentRight="true"
android:paddingTop="5dp"
android:paddingBottom="10dp"
android:src="@drawable/line1"
android:id="@string/line_2_id"/>
</RelativeLayout>
Sie zeigen eine RelativeLayout, kein Linearlayout? –
Ich habe mehrere andere 'View's unter diesem' RelativeLayout', die relative Positionierung verwenden. –