Ich zeige Daten in der Listenansicht. Ich möchte alle Namen in der gleichen Ausrichtung haben. Ich habe Gewicht verwendet, weil ich nicht möchte, dass das Bild den größten Teil des Bildschirms einnimmt. Aber auf diese Weise kann ich Bilder nicht auf die gleiche Weise ausrichten. So sieht es aus. image of pageAndroid - Gleiche Ausrichtung - Layout
Hier ist mein Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/imageView"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:paddingLeft="20dp"
android:scaleType="fitStart"
app:srcCompat="@drawable/food_icon" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="3"
android:paddingLeft="0dp">
<TextView
android:id="@+id/menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="0dp"
android:text="TextView"
android:textSize="18sp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<TextView
android:id="@+id/cost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="TextView"
android:textSize="14sp" />
<TextView
android:id="@+id/owner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="TextView" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
Ich brauche Hilfe. Danke ...
Warum haben Sie verschachtelt LinearLayouts wurde? Können Sie ein Beispiel veröffentlichen, wie es aussehen soll? – Nick
android: gravity = "left" benutze das für den Menütext id –
@Nick Das ist was ich eigentlich will aber auch ich will dass alle Namen bei gleicher Ausrichtung beginnen. Vielleicht kann ich es nicht auf Englisch erklären. Ich möchte, dass Namen in derselben X-Koordinate beginnen. Zum Beispiel suchen Joe und Stevekjflk nicht in der gleichen Koordinate –