1

リストビューがあり、リストビュー全体をカバーする背景グラデーションが必要です。各行のグラデーションは必要ありません。私が得るのは白い背景だけです。

mybg.xml のグラデーションのコード:

<?xml version="1.0" encoding="utf-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
  <item>
    <shape>
      <gradient
        android:startColor="#e6e6e6"
        android:endColor="#ffffff"
        android:angle="45" />
    </shape>
  </item>
</selector>

マイリストビュー:

    <ListView
        android:id="@+id/lvEvents"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:background="@drawable/mybg"
        android:cacheColorHint="#00000000"
        android:divider="#ffc0c0c0"
        android:dividerHeight="1dp"
        android:scrollingCache="true" />
4

2 に答える 2

2

@null を使用して、行ビューの背景を透明に設定してみてください。

于 2013-10-23T12:00:35.460 に答える
1

あなたは形を逃しました、これを試してください

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

    <gradient
        android:angle="270"
        android:centerColor="#000000"
        android:endColor="#404040"
        android:startColor="#404040" />

</shape>
于 2013-10-23T11:59:32.177 に答える