WEB开发网
开发学院手机开发Android 开发 Android ExpandableListActivity 使用 阅读

Android ExpandableListActivity 使用

 2010-05-29 06:02:00 来源:WEB开发网   
核心提示:public View getGroupView(int groupPosition, boolean isExpanded,View convertView, ViewGroup parent) {// TODO Auto-generated method stubreturn null;}@Overridepubl

public View getGroupView(int groupPosition, boolean isExpanded,

View convertView, ViewGroup parent) {

// TODO Auto-generated method stub

return null;

}

@Override

public boolean hasStableIds() {

// TODO Auto-generated method stub

return false;

}

@Override

public boolean isChildSelectable(int groupPosition, int childPosition) {

// TODO Auto-generated method stub

return false;

}

}

3. 填充ExpandInfoAdapter 的函数

* 完成与 Child 功能相关的函数列表

写道

public Object getChild(int arg0, int arg1)

public long getChildId(int arg0, int arg1)

public View getChildView(int arg0, int arg1, boolean arg2, View arg3,

ViewGroup arg4)

public int getChildrenCount(int arg0)

其实现如下:

Java代码

@Override

public Object getChild(int arg0, int arg1) {

// TODO Auto-generated method stub

return child.get(arg0).get(arg1);

}

@Override

public long getChildId(int arg0, int arg1) {

// TODO Auto-generated method stub

return arg1;

}

@Override

public int getChildrenCount(int arg0) {

// TODO Auto-generated method stub

return child.get(arg0).size();

}

@Override

public View getChildView(int arg0, int arg1, boolean arg2, View arg3,

ViewGroup arg4) {

// TODO Auto-generated method stub

return getChildViewStub(child.get(arg0).get(arg1).toString());

}

public TextView getChildViewStub(String s) {

// Layout parameters for the ExpandableListView

AbsListView.LayoutParams lp = new AbsListView.LayoutParams(

ViewGroup.LayoutParams.FILL_PARENT, 64);

上一页  1 2 3 4 5 6 7  下一页

Tags:Android ExpandableListActivity 使用

编辑录入:coldstar [复制链接] [打 印]
赞助商链接