2013-11-23 288 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