80,493
社区成员
发帖
与我相关
我的任务
分享// 创建组/子视图
public TextView getGenericView(String s) {
// Layout parameters for the ExpandableListView
AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT, 40);
TextView text = new TextView(a.this);
text.setLayoutParams(lp);
// Center the text vertically
text.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
// Set the text starting position
text.setPadding(36, 0, 0, 0);
text.setText(s);
return text;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
String string = group.get(groupPosition);
LayoutInflater inflater = (LayoutInflater) a.this
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.c, null);
chil c = new chil();
c.tv = (TextView) convertView.findViewById(R.id.tv2);
c.tv.setText(string);
return convertView;
}