2013-11-23 187 views
0

我正在開發tablet.i應用程序有xml文件我把這個文件佈局文件夾和layout-land文件夾在這個xml我用framelayout包括圖像視圖,但是當我運行應用程序圖像不顯示。你可以嗎告訴我爲什麼圖像不顯示。圖像不顯示

我連着xml文件

<?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> 
+0

您是否想在tabhost或framelayout中顯示圖像。要在framelayout中加載圖像,您需要使用Fragment然後加載圖像 –

+0

我需要在tabhost.below下面顯示圖像tahhost有空白區域我想設置圖像作爲背景。 – user2982189

+0

然後它的簡單加載使用你的片段framelayout圖像 –

回答

0

這一定是因爲你給了高度tabHost爲match_parent .Replace它wrap_content和你imageView也使用wrap_content身高的完整源代碼。

+0

@Manishika .....好..你是 – Piyush