Tuesday, April 29, 2014

ExpandableListView how to get the serial number in two lists


I define an array
private String [] [] arms = new String [] [] {
{"Trunk", "garden trail", "garage entrance", "South Gate toilet", "Building 6 South Gate," "Garden Trellis", "sculpture"},
{"Trunk", "garden trail"},
{"Garage entrance", "South Gate toilet", "Building 6 South Gate," "Garden Trellis", "sculpture"}};
Three levels are shown in the list
Now want to add the serial number on the front, I do not know how to get. . . Big knees and begged God to help solve
@ Override
public View getChildView (int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
View view = convertView;
if (view == null) {
LayoutInflater inflater = (LayoutInflater) getSystemService (Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate (R.layout.member_childitem, null);
}
final TextView title = (TextView) view
. FindViewById (R.id.child_text);
title.setText (getChild (groupPosition, childPosition) toString ().);
title.setOnClickListener (new OnClickListener () {
public void onClick (View v) {

String nameStr = title.getText () toString ();.
beano.setName (nameStr);
Intent intent = new Intent (ExListView.this,
GetListView.class);
intent.putExtra ("PERSON_INFO", beano);
startActivity (intent);

}
});
return view;

}
These are my two lists of code, can achieve the display, but not in front of the serial number, in order to achieve {"a main road", "2 garden trail", 3 "garage entrance", 4 "South Gate toilet", 5 "6 Building South Gate "," 6 small garden pavilion "," 7 sculpture "},
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Serial number: childPosition +1
Reply:
cited a floor hjywyj reply:
number: childPosition +1

Cock, Great God, please tell me your QQ ah?
Reply:
cited a floor hjywyj reply:
number: childPosition +1

Properly properly! ! !

No comments:

Post a Comment