So platzieren Sie zwei Textansichten Marked within red rectangle
in relativen Layouts mit ausgerichtetem Mittelpunkt. Wie kann ich wie im Bild gezeigt entwerfen? Hier sind Text und Nummer beide Textansichten.So zentrieren Sie zwei Textansichten als zentriert im relativen Layout
Ich habe folgendes versucht, aber ich konnte nicht mittig ausgerichtet Blick auf die relative Layout erhalten.
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="50dp">
<LinearLayout
android:id="@+id/location_party_size_lbl_layer"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:orientation="horizontal">
<TextView
android:id="@+id/location_party_size_lbl"
android:layout_width="170dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_horizontal"
android:maxLines="2"
android:text="@string/loc_estimate"
android:textColor="@android:color/white"
android:textSize="15sp" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_toRightOf="@+id/location_party_size_lbl_layer"
android:orientation="horizontal"
android:paddingBottom="10dp"
android:paddingTop="10dp"
android:weightSum="1.0">
<TextView
android:id="@+id/location_party_size"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.48"
android:background="@drawable/rounded_bg"
android:gravity="center"
android:textColor="@android:color/white" />
<TextView
android:id="@+id/qnowscreen_dummy_tv"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.52"
android:visibility="invisible" />
</LinearLayout>
</RelativeLayout>
vielleicht könnten Sie ein lineares Layout mit horizontaler Ausrichtung und Gewichten auf seinen Kindern verwenden? – Bram
Können Sie aus Ihren XML-Tags angeben, welche zwei Textsichten Sie zentriert ausrichten möchten und ob sie vertikal und horizontal zentriert sein sollen, als ob Sie zwei haben, überlappen sie sich? Wie möchten Sie, dass sie nebeneinander positioniert sind? Es ist unklar von dem Bild. –
@ Ms Yvette ǝʇʇǝʌʎ sW, location_party_size_lbl wird für die Anzeige von Text "geschätzt ...." und location_party_size für die Anzeige von "2" verwendet –