2013-03-11 19 views
1

我一直面臨佈局的一個奇怪問題。問題是主佈局有一個背景,即灰色(#DCDCDC)。它由一個小孩ScrollView與垂直LinearLayout組成。它包含2個視圖:一個是TextView黑色背景,接下來是谷歌地圖。Android整個屏幕取決於其子視圖的背景而變得更暗或者更亮

現在的問題是:當TextView變得可見時就可以。但是,當滾動ScrollView以使地圖可見時,整個屏幕變得較暗,這從一致性的角度來看是不可取的。

而令人驚訝的是,這個問題只是在Android 4.x版本的情況下。

以下是佈局:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@color/grey" 
    android:orientation="vertical" 
    android:padding="5dp" > 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center_horizontal" 
     android:layout_marginBottom="10dp" 
     android:layout_marginTop="10dp" > 

     <Button 
      android:id="@+id/back" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="left|center_vertical" 
      android:background="@drawable/_btn_back" 
      android:onClick="clickHandler" 
      android:paddingLeft="15dp" 
      android:paddingRight="10dp" 
      android:text="@string/terms_and_condition_terug" 
      android:textColor="@color/white" 
      android:textStyle="normal" /> 

     <TextView 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" /> 

     <ImageView 
      android:id="@+id/logo" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical|center_horizontal" /> 

     <TextView 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" /> 

     <ImageView 
      android:id="@+id/info" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="right|center_vertical" 
      android:layout_marginRight="10dp" 
      android:clickable="true" 
      android:onClick="clickHandler" 
      android:src="@drawable/_info" /> 
    </LinearLayout> 

    <ScrollView 
     android:layout_width="fill_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" > 

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

      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="700dp" 
       android:background="@drawable/itemlistbackground" /> 

      <com.readystatesoftware.maps.TapControlledMapView 
       android:id="@+id/mapview" 
       android:layout_width="fill_parent" 
       android:layout_height="700dp" 
       android:layout_weight="1" 
       android:apiKey="@string/mapApiKey" 
       android:clickable="true" /> 
     </LinearLayout> 
    </ScrollView> 

</LinearLayout> 

而以下是截圖當TextView時可見的地圖是可見 when textview is visible background is okay

和下面的截圖被帶到 when map is visible

如果你看看仔細地在那些屏幕上,第二個圖像比第一個不需要的圖像更暗淡。我不想在顯示地圖的時候使用調光器屏幕。請幫助我。

+0

你的意思是帶有後退按鈕的頂部酒吧嗎?這不僅僅是一種對比效應嗎? – eski 2013-03-11 07:19:36

+0

是的,整個屏幕也比較暗淡,頂部也是(儘管你可能看不到它)。不,它不是對比效果。 – Dipendra 2013-03-11 07:29:15

回答

0

我剪下灰色的邊框,將它們相互比較,它們看起來和我一樣。在第一張截圖中也有一個漸變,使其更具光澤感。

enter image description here

+0

沒有。沒有漸變效果。 – Dipendra 2013-03-11 07:54:47

+0

我不知道該說什麼。除了您展示的屏幕截圖之外,它是否與設備上的背光有關? 就你發佈的截圖而言,顏色的絕對客觀值沒有區別。我上傳的比較證明了這一點。 – eski 2013-03-11 07:59:21

+0

謝謝你的努力。但問題出在那裏,並且一星期以來一直試圖解決,但沒有解決方案。雖然上傳的圖像使得難以實現這個問題,但是當你在真實設備上使用4.x – Dipendra 2013-03-11 08:02:29