我一直面臨佈局的一個奇怪問題。問題是主佈局有一個背景,即灰色(#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
時可見的地圖是可見
和下面的截圖被帶到
如果你看看仔細地在那些屏幕上,第二個圖像比第一個不需要的圖像更暗淡。我不想在顯示地圖的時候使用調光器屏幕。請幫助我。
你的意思是帶有後退按鈕的頂部酒吧嗎?這不僅僅是一種對比效應嗎? – eski 2013-03-11 07:19:36
是的,整個屏幕也比較暗淡,頂部也是(儘管你可能看不到它)。不,它不是對比效果。 – Dipendra 2013-03-11 07:29:15