1

childViewのディバイダーを設定しています。しかし、展開していると、childRows ディバイダーの色が子行と親行で変化します。なぜそうなのですか?

私のexpandableListViewのxml:

<?xml version="1.0" encoding="utf-8"?>
<ExpandableListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:childDivider="@color/dark_orange"
android:indicatorLeft="?android:attr/expandableListPreferredItemIndicatorLeft"
android:indicatorRight="?android:attr/expandableListPreferredItemIndicatorRight"
android:groupIndicator="@drawable/group_indicator">
 </ExpandableListView>
4

2 に答える 2

2

ExpandableListViewをに変更します

<?xml version="1.0" encoding="utf-8"?>

<ExpandableListView 
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/list"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_alignParentLeft="true"
  android:dividerHeight="2dp"<!--===========> problem is here-->
  android:divider="@drawable/yellow"
  android:childDivider="@color/dark_orange"
  android:indicatorLeft="?android:attr/expandableListPreferredItemIndicatorLeft"
  android:indicatorRight="?android:attr/expandableListPreferredItemIndicatorRight"
  android:groupIndicator="@drawable/group_indicator"
/>

子仕切りの高さを設定するのが問題だと思います。修正してください。

于 2012-07-23T13:08:47.890 に答える
0

I've set divider colors through code like this:

int[] colors = {0, 0xFFFF0000, 0}; // red for the example 
lv.setChildDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors)); 
lv.setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors));

Note this sets a divider at full color in the middle fading to nothing at bth edges, but it should convey the method for setting your ExpandableListView dividers in your code. It would be just as easy to set the color to a single solid color.

于 2012-07-26T14:47:15.800 に答える