Question

i am developing application for tablet.i have xml file i put this files layout folder and layout-land folder in this xml i used framelayout including image view but when i run application image is not displayed.Could you tell me why image is not displayed.

i attached full source code of xml file

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/frontbackground"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:background="@color/header"
        android:orientation="horizontal"
        android:weightSum="3" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="@drawable/navigation" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="2dp"
            android:text="Kesari"
            android:textColor="@color/textcolor"
            android:textSize="14sp" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginLeft="5dp"
            android:layout_weight="2"
            android:text="Choose from the exciting holiday packages across 7 continents from world class travel company"
            android:textColor="@color/textcolor"
            android:textSize="14sp" />
    </LinearLayout>

   <TabHost 
         android:id="@android:id/tabhost"
         android:layout_width="match_parent"
         android:layout_height="match_parent">

    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical" >

        <HorizontalScrollView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:fillViewport="true"
                android:scrollbars="none">

            <TabWidget
                    android:id="@android:id/tabs"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >
            </TabWidget>

        </HorizontalScrollView>

        <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="match_parent"
                android:layout_height="match_parent" >

            <RelativeLayout
                android:id="@+id/tab1"
                android:layout_width="match_parent"
                android:layout_height="match_parent" >

                <LinearLayout
                    android:id="@+id/linearLayout1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentTop="true"
                    android:layout_marginLeft="20dp"
                    android:orientation="vertical" >
                </LinearLayout>

                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_toLeftOf="@+id/linearLayout1" >
                </RelativeLayout>
            </RelativeLayout>

            <RelativeLayout
                    android:id="@+id/tab2"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" >
            </RelativeLayout>

            <RelativeLayout
                    android:id="@+id/tab3"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" >
            </RelativeLayout>

            <RelativeLayout
                    android:id="@+id/tab4"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" >
            </RelativeLayout>

            <RelativeLayout
                    android:id="@+id/tab5"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" >
            </RelativeLayout>

            <RelativeLayout
                    android:id="@+id/tab6"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" >
            </RelativeLayout>

            <RelativeLayout
                    android:id="@+id/tab7"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" >
            </RelativeLayout>
        </FrameLayout>
    </LinearLayout>
</TabHost>

<FrameLayout
    android:id="@+id/framelayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ImageView
        android:id="@+id/ImageView01"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/malaysia1"></ImageView>  

</FrameLayout>  


</LinearLayout>
Was it helpful?

Solution

This must be because you have given height to tabHost as match_parent.Replace it with wrap_content and your imageView also use wrap_content for height.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top