Domanda

I have the attached exception when I try to make a ExpandableListView

can anyone help!

enter image description here

this is my method

@Override
    public View getChildView(int groupPosition, int childPosition,
            boolean isLastChild, View convertView, ViewGroup parent) {

        View childView;

        if (convertView == null) {

            LayoutInflater infalInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            childView = infalInflater.inflate(R.layout.side_menu_child_view,null);
        } else {
            childView = convertView;
        }

        TextView linkName       = (TextView) childView.findViewById(R.id.child_title_text);
        LinkEntity linkEntity   = getChild(groupPosition, childPosition);
        linkName.setText(linkEntity.getDisplayName(true));
        return childView;
    }

this is the xml of my list

<EditText
    android:id="@+id/search_edit_text"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:inputType="text"
    android:visibility="gone" />

<ExpandableListView
    android:id="@+id/expandable_side_list_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:cacheColorHint="@android:color/transparent"
    android:childDivider="@null"
    android:childIndicator="@null"
    android:divider="@drawable/side_menu_separator"
    android:dividerHeight="0dp"
    android:groupIndicator="@null"
    android:listSelector="@android:color/transparent" >
</ExpandableListView>

È stato utile?

Soluzione

I have solved this problem by set divider to my child divider instead of null, I don't know why, but thanks all any way

Altri suggerimenti

Try removing this line:

LayoutInflater infalInflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

And put this line above the if statement:

mInflater = LayoutInflater.from(context);

Where mInflater is declared as a class variable like so LayoutInflater mInflater;

See if this works.

Just add this to your ExapndableListview android:divider="@null"

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top