문제

This is my 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>

The problem is that the ImageView in the bottom of the XMLdoes not get displayed. Any ideas?

10X :)

도움이 되었습니까?

해결책

Each of your views contain the properties of "fill_parent" for their layout widths and heights. You need to either specify "wrap_content" for them, or place them in containers with positive and negative margins, or else they will all attempt to take up all of the available space.

다른 팁

You should remove android:layout_weight="1" from image view and image will appear.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top