FrameLayoutにGoogleマップのフラグメントを含むレイアウトがあります。また、私はグラデーションの背景と地図上に新しいビューを配置しました。 レイアウト:透明グラディエントの問題
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
<com.google.android.gms.maps.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<View
android:id="@+id/fadeTop"
android:layout_width="match_parent"
android:layout_height="@dimen/fade_height"
android:layout_gravity="top"
android:background="@drawable/list_fade_top"/>
<include layout="@layout/top_line_mid_gray"/>
</FrameLayout>
list_fade_top:
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:angle="90"
android:startColor="@color/fade_start_color"
android:centerColor="@color/fade_center_color"
android:endColor="@color/fade_end_color"
android:type="linear"/>
</shape>
- 開始/終了と中央の色。
<color name="fade_start_color">#00000000</color> <color name="fade_center_color">#4f000000</color> <color name="fade_end_color">#ff000000</color>
- 開始/終了と中心色:この勾配は、2つの光路で描きます。
<gradient android:angle="90" android:startColor="@color/fade_start_color" android:endColor="@color/fade_end_color" android:type="linear"/>
:
中心色なしの勾配で同じ挙動
-
をこの勾配は1光ラインと描画します
n黒(または半透明の黒)から完全な透明まで滑らかな線形グラデーションを描きますか?
ハードウェアアクセラレーションのオン/オフ、 'getWindow()。setFormat(PixelFormat.RGBA_8888);'何も私を助けません。
更新1 githubで簡単なアプリケーションを作成しました。 https://github.com/ralexey/TestApp 色の背景と勾配を持つアクティビティだけです。
<color name="fade_start_color">#00000000</color> <color name="fade_center_color">#6f000000</color> <color name="fade_end_color">#ff000000</color>
感謝を助けるかもしれないが、それは私を助けていない、あなたのグラデーションで
android:centerY="y%p"
をこの行を追加します。 –