Android-UI-gravity="right" funktioniert nicht
Ich versuche zu bauen, ein UI-Bildschirm.
hier ist die main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.33"
android:orientation="horizontal" >
<ImageView
android:id="@+id/kartoMap"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_gravity="left"
android:src="@drawable/ic_launcher" />
<VideoView
android:id="@+id/robotVideo"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:layout_weight="1" />
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.66"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="0.2"
android:orientation="vertical" >
<ToggleButton
android:id="@+id/stepsBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_weight="1"
android:text="Steps"
android:textOff="STEPS"
android:textOn="STEPS" />
<Button
android:id="@+id/ArmsBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Arms HOLDER" />
</LinearLayout>
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/joystickRight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@drawable/joystick" />
<ImageView
android:id="@+id/innerCircle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/inner_circle" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
Ist das problem in der Bildansicht namens 'joystickRight'.
Ich will, dass es an der rechten Seite des Bildschirms statt, sondern -
das frameLayout und das linearLayout sind unterteilt in den unteren Bildschirm, und der Bildansicht bleibt in der Mitte des frameLayout. Warum??
Du musst angemeldet sein, um einen Kommentar abzugeben.
Weil das FrameLayout ist festgelegt wrap_content für Höhe und Breite. So ist es der Angleichung der rechts im FrameLayout, die nur so breit wie die imageviews.
Tun
FrameLayout android:layout_width="fill_parent"
Versuchen, hinzufügen von leeren Anzeigen in horizontalen LinearLayout zwischen-element, das Sie wollen, sehen Sie Links und Elemente, die Sie wollen, um zu sehen, Recht, z.B.:
Warum nicht ein
RelativeLayout
stattFrameLayout
und dann für Ihre joystickRight nutzen Sie die Möglichkeitandroid:layout_alignParentRight="true"
Sollten Sie nutzen " android:layout_gravity="right" und die Ansicht wird rechts ausgerichtet, in der Eltern.
Oder Sie können tun, als Phobos vorgeschlagen, und stellen Sie die Ansicht Breite "match_parent" und dann
android:gravity
funktioniert wie Sie es erwarten.