2011-08-26 63 views
0

我的應用程序中的圖像有問題。 我想要一個頭部圖像,將採取我的應用程序的所有寬度。 要做到這一點,我創建了一個非常寬的圖片,中心的主要對象是 ,然後在我的佈局中居中位圖。中心位圖顯示奇怪的Android問題

使用代碼:

<bitmap xmlns:android="http://schemas.android.com/apk/res/android" 
    android:src="@drawable/header" 
    android:gravity="center_horizontal|bottom" /> 

和佈局定義:

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:fillViewport="true" 
    android:background="#ffffff" 
    android:layout_gravity="center_horizontal" > 

    <LinearLayout 
    android:id="@+id/accueil_layout" 
     android:orientation="vertical" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:background="#ffffff" 
     android:layout_gravity="center_horizontal" > 

     <FrameLayout 
     android:layout_width="fill_parent" 
     android:layout_height="150dip" 
     android:background="@drawable/bitmap_header" 
     android:layout_weight="1"> 

     <TextView 
      android:id="@+id/allure" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="@string/txt_allure" 
     /> 

     </FrameLayout> 

    <TextView 
     android:id="@+id/slogan" 
     android:text="@string/txt_slogan" 
     /> 

代碼,這是在第一次執行運作良好。

,你可以在這裏看到:http://imagebin.org/index.php?mode=image&id=169619

,如果我叫其他意圖,然後再回到那一個,它仍然正常顯示。

但是,如果我將另一個Intent調用到同一活動中,則此活動的第二個實例顯示不正常。

如下:http://imagebin.org/index.php?mode=image&id=169620

任何人的想法,就如何我能解決這個問題?

回答

1

我認爲必須在FrameLayout下使用TextView,因爲它不會在第二張圖片上顯示。也許將FrameLayout更改爲RelativeLayout或LinearLayout,看看會發生什麼。