我有附加的異常,當我試圖做一個ExpandableListViewExpandableListView中的空指針異常
任何人都可以幫助!
這是我的方法
@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;
}
這是我名單的XML
<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>
stacktrace從未引用任何類,並且無法呈現分隔線,您是否在xml中設置了自定義分隔線? –
發佈您的xml文件 – Piyush
我已經用xml更新了帖子,但例外來自getChildView,列表已經顯示,但是當我按組項目顯示它的孩子時,我得到了異常 –