/ / wie man Ansicht nach links und rechts richtig in Android-Layout mit Schwerkraft oder Layout Schwerkraft ausrichten - Android, Layout, linear, Schwerkraft

wie man Ansicht nach links und recht richtig in Android-Layout mit Schwerkraft oder Layout Schwerkraft ausrichten - Android, Layout, linear, Schwerkraft

Ich verwende folgendes Layout

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:layout_marginTop="10dp"
android:background="@drawable/cardview_shadow"
android:elevation="2dp"
android:gravity="center_vertical"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:gravity="fill_horizontal"
android:orientation="horizontal">

<ImageView
android:id="@+id/ic_find_previous_holo_dark"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="left"
android:src="@drawable/ic_find_previous_holo_dark" />

<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/view_flipper"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/emoji_u1f33c" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/emoji_u1f33c" />
</ViewFlipper>

<ImageView
android:id="@+id/ic_find_next_holo_dark"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="right"
android:src="@drawable/ic_find_next_holo_dark" />
</LinearLayout>

</LinearLayout>

Ich möchte den linken Pfeil nach links und den rechten Pfeil nachdas rechte und mittlere Layout, um die Lücke in der Mitte zu füllen, ohne genaue Breite in dpi, px usw. anzugeben, aber ich kann dieses Layout nicht erreichen. Ich brauche diese Art von Layout die meiste ZeitBildbeschreibung hier eingeben

Antworten:

0 für die Antwort № 1

In Ihrem Fall müssen Sie geben android:layout_weight=1 zu deinem ViewFlipper Damit es den Rest der anderen 2 Bildansichten freigibt (wird beide Ansichten seither auf die Seiten schieben) ViewFlipper ist die mittlere Ansicht). Eine bessere Erklärung wird hier gegeben https://developer.android.com/guide/topics/ui/layout/linear.html Überprüfen Sie den Abschnitt Layoutgewicht.