230dpの高さ(つまり、画面全体ではない)の勾配を作成する必要があります。残りの画面は単色です。私はこれを行う方法を理解することができません - 私はすべての画面を埋めるために拡大するグラデーションに終わる試してみましょう。勾配のない勾配
<?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="#333333" >
<LinearLayout
android:id="@+id/container"
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:background="@drawable/grey_gradient_bg" >
<!-- a bunch of content, buttons, etc. -->
</LinearLayout>
</LinearLayout>
しかし、勾配は、画面全体を埋めるために拡張されます。私は、XMLの私のLinearLayoutの背景として、その描画可能に適用
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:top="230dp">
<shape android:shape="rectangle" >
<color android:color="#333333" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
<gradient
android:angle="270"
android:endColor="#333333"
android:startColor="#D9D9D9"
android:type="linear" />
<size android:height="230dp" />
</shape>
</item>
</layer-list>
:私の現在のXMLは次のようになります。
私はバックグラウンドにPNGを使用しようとしましたが、the banding problems described hereを取得しましたが、この修正はまだ手伝ってくれませんでした。
あなたのLinearLayoutは多分別のレイアウトの子である場合親はあなたが期待しているように伸びていません。レイアウトxlm全体を提供して解析してください。 – woodshy
完全なレイアウトXMLで編集しました。 – matt