Frage

Das ist mein Layout:

<?xml version="1.0" encoding="UTF-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">

      <SurfaceView android:id="@+id/preview_view"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_centerInParent="true"/>

      <ViewfinderView
            android:id="@+id/viewfinder_view"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@color/transparent"/>

      <LinearLayout 
            android:id="@+id/result_view"
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@color/result_view"
            android:visibility="gone"
            android:padding="4dip">

     </LinearLayout>
     <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" >

            <ImageView android:id="@+id/App_logo"
                  android:src="@drawable/mylogo"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:layout_weight="1" />

            <TextView android:id="@+id/status_view"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:layout_gravity="bottom|center_horizontal"
                  android:background="@color/transparent"
                  android:text="@string/msg_default_status"
                  android:textColor="@color/status_text"
                  android:textSize="14sp"/>

      </LinearLayout>
</FrameLayout>

Das Problem ist, dass die ImageView im Boden des XMLwird nicht angezeigt. Irgendwelche Ideen?

10x :)

War es hilfreich?

Lösung

Jede Ihrer Ansichten enthält die Eigenschaften von "fill_parent" für ihre Layoutbreiten und -höhen. Sie müssen entweder "Wrap_Content" für sie angeben oder sie in Behältern mit positiven und negativen Margen platzieren. Andernfalls versuchen sie alle, den gesamten verfügbaren Platz zu beanspruchen.

Andere Tipps

Sie sollten Android entfernen: layout_weight = "1" von Bildansicht und Bild wird angezeigt.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top