我有一个expandableList,在子元素中我添加了一些EditText,checkbox和spinner。这些是正确创建和显示的。选中Checkbox后会显示其他EditText和Spinner,然后用户可以添加文本并从微调器中选择值。我想为每个子元素检索这些附加视图(edittext,Spinner,CheckBox)的值。在保存单击时,我想迭代所有元素并检索这些editText,Spinner和checkBox中的值。目前我正在使用下面的代码,但点击保存后,它总是返回与最后一个子元素相关的值。如果有关此问题的更多信息,请与我们联系。 ExpandableList ScreenShot
MainActivity -
public class MainActivity extends AppCompatActivity {
ExpandableListAdapter listAdapter;
ExpandableListView expListView;
List<String> listDataHeader;
HashMap<String, List<String>> listDataChild;
Button save;
Button cancel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
save = (Button) findViewById(R.id.save);
// get the listview
expListView = (ExpandableListView) findViewById(R.id.lvExp);
// preparing list data
prepareListData();
listAdapter = new ExpandableListAdapter(getApplicationContext(), listDataHeader, listDataChild);
// setting list adapter
expListView.setAdapter(listAdapter);
expListView.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
save.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
System.out.println("Save clicked");
for(int i = 0; i < listAdapter.getGroupCount();i++) {
for (int k = 0; k < listAdapter.getChildrenCount(i); k++) {
String temp = listAdapter.recollect(i,k);
System.out.println("For i="+i+" and k="+k+" string value is="+temp);
}
}
}
});
}
/*
* Preparing the list data
*/
private void prepareListData() {
listDataHeader = new ArrayList<String>();
listDataChild = new HashMap<String, List<String>>();
// Adding child data
listDataHeader.add("Nokia");
listDataHeader.add("Apple");
listDataHeader.add("Samsung");
// Adding child data
List<String> nokia = new ArrayList<String>();
nokia.add("Nokia1");
nokia.add("Nokia2");
List<String> apple = new ArrayList<String>();
apple.add("Apple1");
apple.add("Apple2");
List<String> samsung = new ArrayList<String>();
samsung.add("Samsung1");
samsung.add("Samsung2");
listDataChild.put(listDataHeader.get(0), nokia); // Header, Child data
listDataChild.put(listDataHeader.get(1), apple);
listDataChild.put(listDataHeader.get(2), samsung);
}
}
MainLayout -
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="dhritiapps.temp.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:id="@+id/lin"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight="1"
android:id="@+id/can"
android:text="Cancel"/>
<Button
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_weight="1"
android:id="@+id/save"
android:text="Save"/>
</LinearLayout>
<ExpandableListView
android:layout_marginTop="10dp"
android:id="@+id/lvExp"
android:layout_below="@+id/lin"
android:layout_height="match_parent"
android:layout_width="match_parent"/>
</RelativeLayout>
ExpandableListAdapter -
public class ExpandableListAdapter extends BaseExpandableListAdapter {
private Context _context;
private List<String> _listDataHeader; // header titles
// child data in format of header title, child title
private HashMap<String, List<String>> _listDataChild;
// private final HashMap<String, String, String> mCheckedItems;
String cat, item, quty, units, notes;
EditText qty;
EditText note;
Spinner unit;
ArrayList <String> ss=new ArrayList<>();
public ExpandableListAdapter(Context context, List<String> listDataHeader,
HashMap<String, List<String>> listChildData) {
this._context = context;
this._listDataHeader = listDataHeader;
this._listDataChild = listChildData;
@Override
public Object getChild(int groupPosition, int childPosititon) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.get(childPosititon);
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public View getChildView(final int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
final String childText = (String) getChild(groupPosition, childPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_item, null);
}
TextView txtListChild = (TextView) convertView
.findViewById(R.id.lblListItem);
final LinearLayout mm = (LinearLayout) convertView.findViewById(R.id.entries);
qty = (EditText) convertView.findViewById(R.id.qty);
note = (EditText) convertView.findViewById(R.id.note);
unit = (Spinner) convertView.findViewById(R.id.unit);
final CheckBox cb = (CheckBox) convertView.findViewById(R.id.cb);
final int grp = groupPosition;
cb.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final CheckBox cb = (CheckBox) v;
if (cb.isChecked()) {
mm.setVisibility(View.VISIBLE);
} else {
mm.setVisibility(View.GONE);
}
System.out.println(ss);
}
});
txtListChild.setText(childText);
return convertView;
}
public String recollect(int grp, int ch) {
cat = getGroup(grp).toString();
item = getChild(grp, ch).toString();
quty = qty.getText().toString();
units = unit.getSelectedItem().toString();
notes = note.getText().toString();
System.out.println("cat="+cat+"; item="+item+"; qty="+quty+"; unit="+units+"; note="+notes);
return cat+";"+item+";"+quty+";"+units+";"+notes+"_";
}
@Override
public int getChildrenCount(int groupPosition) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.size();
}
@Override
public Object getGroup(int groupPosition) {
return this._listDataHeader.get(groupPosition);
}
@Override
public int getGroupCount() {
return this._listDataHeader.size();
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
String headerTitle = (String) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_group, null);
}
TextView lblListHeader = (TextView) convertView
.findViewById(R.id.lblListHeader);
lblListHeader.setTypeface(null, Typeface.BOLD);
lblListHeader.setText(headerTitle);
return convertView;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
}
list_Group.xml -
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp"
android:background="#000000">
<TextView
android:id="@+id/lblListHeader"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="2dp"
android:textSize="17dp"
android:textColor="#f9f93d" />
</LinearLayout>
list_item.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="55dip"
android:orientation="vertical"
android:background="#ef8d8d">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingLeft="5dp"
android:layout_weight="1"
>
<TextView
android:id="@+id/lblListItem"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="17dip"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:textColor="#ff0000"
android:layout_weight="5"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/cb"
android:checked="false"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:id="@+id/entries"
android:orientation="horizontal"
android:paddingLeft="8dp"
android:visibility="gone"
android:paddingBottom="2dp"
android:layout_weight="1">
<EditText
android:id="@+id/qty"
android:layout_width="0dp"
android:layout_height="30dp"
android:hint="Qunatity"
android:layout_weight="1"
android:background="#12f212"
android:layout_margin="3dp"
android:textColor="#700a55"
android:inputType="numberDecimal"
android:maxLength="8"
android:textSize="12dip"/>
<Spinner
android:id="@+id/unit"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_weight="1"
android:entries="@array/units"
android:background="#12f212"
android:layout_margin="3dp"
android:textColor="#700a55"
/>
<EditText
android:id="@+id/note"
android:layout_width="0dp"
android:layout_height="30dp"
android:hint="Note"
android:layout_weight="4"
android:background="#12f212"
android:layout_margin="3dp"
android:textColor="#700a55"
android:textSize="12dip"
android:maxLength="50"/>
</LinearLayout>
</LinearLayout>
点击保存后,这就是我得到的 -
System.out: For i=0 and k=0 string value is=Nokia;Nokia1;2;C;Note for Samsung2_
System.out: For i=0 and k=1 string value is=Nokia;Nokia2;2;C;Note for Samsung2_
System.out: For i=1 and k=0 string value is=Apple;Apple1;2;C;Note for Samsung2_
System.out: For i=1 and k=1 string value is=Apple;Apple2;2;C;Note for Samsung2_
System.out: For i=2 and k=0 string value is=Samsung;Samsung1;2;C;Note for Samsung2_
System.out: For i=2 and k=1 string value is=Samsung;Samsung2;2;C;Note for Samsung2_
虽然应该是这样的 -
System.out: For i=0 and k=0 string value is=Nokia;Nokia1;123;A;Note for Note for Nokia1
System.out: For i=0 and k=1 string value is=Nokia;Nokia2;;;
System.out: For i=1 and k=0 string value is=Apple;Apple1;;;
System.out: For i=1 and k=1 string value is=Apple;Apple2;;;
System.out: For i=2 and k=0 string value is=Samsung;Samsung1;;;
System.out: For i=2 and k=1 string value is=Samsung;Samsung2;2;C;Note for Samsung2_
答案 0 :(得分:2)
添加新课程CustomChilds
package stack.buy.com.stackdemos;
/**
* Created by Desktop - Ganesh on 10/14/2016.
*/
public class CustomChilds {
String Quntity;
String Unit;
String Note;
String GroupName;
public String getQuntity() {
return Quntity;
}
public void setQuntity(String quntity) {
Quntity = quntity;
}
public String getUnit() {
return Unit;
}
public void setUnit(String unit) {
Unit = unit;
}
public String getNote() {
return Note;
}
public void setNote(String note) {
Note = note;
}
public String getGroupName() {
return GroupName;
}
public void setGroupName(String groupName) {
GroupName = groupName;
}
public CustomChilds(String quntity, String unit, String note, String groupName) {
Quntity = quntity;
Unit = unit;
Note = note;
GroupName = groupName;
}
public CustomChilds() {
}
}
适配器:
public class ExpandableListAdapter extends BaseExpandableListAdapter {
private Context _context;
private List<String> _listDataHeader; // header titles
// child data in format of header title, child title
private HashMap<String, List<CustomChilds>> _listDataChild;
// private final HashMap<String, String, String> mCheckedItems;
String cat, item, quty, units, notes;
ArrayList<String> ss = new ArrayList<>();
public ExpandableListAdapter(Context context, List<String> listDataHeader,
HashMap<String, List<CustomChilds>> listChildData) {
this._context = context;
this._listDataHeader = listDataHeader;
this._listDataChild = listChildData;
}
@Override
public CustomChilds getChild( int groupPosition, int childPosititon){
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.get(childPosititon);
}
@Override
public long getChildId ( int groupPosition, int childPosition){
return childPosition;
}
@Override
public View getChildView ( final int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent){
final CustomChilds childText =getChild(groupPosition, childPosition);
final ViewHolder holder;
View row = convertView;
if (row == null) {
LayoutInflater inflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.list_item, parent, false);
holder = new ViewHolder();
holder.mm = (LinearLayout) row.findViewById(R.id.entries);
holder.qty = (EditText) row.findViewById(R.id.qty1);
holder.note = (EditText) row.findViewById(R.id.note);
holder.unit = (Spinner) row.findViewById(R.id.unit);
holder.cb = (CheckBox) row.findViewById(R.id.cb);
holder.txtListChild = (TextView) row
.findViewById(R.id.lblListItem);
row.setTag(holder);
}
else {
// view already exists, get the holder instance from the view
holder = (ViewHolder) row.getTag();
}
List<CustomChilds> temp = _listDataChild.get(this._listDataHeader.get(groupPosition));
temp.set(childPosition,new CustomChilds(holder.qty.getText().toString(),holder.unit.getSelectedItem().toString(),holder.note.getText().toString(),childText.GroupName));
final int grp = groupPosition;
holder.cb.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final CheckBox cb = (CheckBox) v;
if (cb.isChecked()) {
holder.mm.setVisibility(View.VISIBLE);
} else {
holder.mm.setVisibility(View.GONE);
}
System.out.println(ss);
}
});
holder.txtListChild.setText(childText.getGroupName());
return row;
}
@Override
public int getChildrenCount(int groupPosition) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.size();
}
@Override
public Object getGroup(int groupPosition) {
return this._listDataHeader.get(groupPosition);
}
@Override
public int getGroupCount() {
return this._listDataHeader.size();
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
String headerTitle = (String) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_group, null);
}
TextView lblListHeader = (TextView) convertView
.findViewById(R.id.lblListHeader);
lblListHeader.setTypeface(null, Typeface.BOLD);
lblListHeader.setText(headerTitle);
return convertView;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
// somewhere else in your class definition
static class ViewHolder {
EditText qty;
EditText note;
Spinner unit;
LinearLayout mm;
CheckBox cb;
TextView txtListChild;
}
}
MainActivity
public class MainActivity extends AppCompatActivity {
ExpandableListAdapter listAdapter;
ExpandableListView expListView;
List<String> listDataHeader;
HashMap<String, List<CustomChilds>> listDataChild;
Button save;
Button cancel;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
save = (Button) findViewById(R.id.save);
listAdapter = new ExpandableListAdapter(getApplicationContext(), listDataHeader, listDataChild);
expListView.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
save.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
System.out.println("Save clicked");
for(int i = 0; i < listAdapter.getGroupCount();i++) {
for (int k = 0; k < listAdapter.getChildrenCount(i); k++) {
CustomChilds child = listAdapter.getChild(i, k);
String unit=child.getUnit();
String note=child.getNote();
String qut=child.getQuntity();
System.out.println("For i="+i+" and k="+k+" string value is="+child.getNote());
}
}
}
});
}
private void prepareListData() {
listDataHeader = new ArrayList<String>();
listDataChild = new HashMap<String, List<CustomChilds>>();
listDataHeader.add("Nokia");
listDataHeader.add("Apple");
listDataHeader.add("Samsung");
List<CustomChilds> nokia = new ArrayList<CustomChilds>();
nokia.add(new CustomChilds("","","","Nokia1"));
nokia.add(new CustomChilds("","","","Nokia2"));
List<CustomChilds> apple = new ArrayList<CustomChilds>();
apple.add(new CustomChilds("","","","Apple1"));
apple.add(new CustomChilds("","","","Apple2"));
List<CustomChilds> samsung = new ArrayList<CustomChilds>();
samsung.add(new CustomChilds("","","","Samsung1"));
samsung.add(new CustomChilds("","","","Samsung2"));
listDataChild.put(listDataHeader.get(0), nokia); // Header, Child data
listDataChild.put(listDataHeader.get(1), apple);
listDataChild.put(listDataHeader.get(2), samsung);
}
}
获取单位,数量和注释onClick
save.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
System.out.println("Save clicked");
for(int i = 0; i < listAdapter.getGroupCount();i++) {
for (int k = 0; k < listAdapter.getChildrenCount(i); k++) {
CustomChilds child = listAdapter.getChild(i, k);
String unit=child.getUnit();
String note=child.getNote();
String qut=child.getQuntity();
System.out.println("For i="+i+" and k="+k+" string value is="+child.getNote());
}
}
}
});
答案 1 :(得分:0)
您正在使用相同的编辑文本,因此它只会为您提供最后的值,而是在编辑文本上添加textchange侦听器,而在onTextChanged()方法中,在列表中添加该编辑文本的值,如下所示: 还要添加一个带有position和use标签的标签来从列表中检索值。
myEditText1.addTextChangedListener(new GenericTextWatcher(myEditText1));
myEditText1.setTag(&#34; theFirstEditTextAtPos:&#34 +位);
private class GenericTextWatcher implements TextWatcher{
private View view;
private GenericTextWatcher(View view) {
this.view = view;
}
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
public void afterTextChanged(Editable editable) {
String text = editable.toString();
//save the value for the given tag :
MyResultAdapter.this.textValues.put(view.getTag(), editable.toString());
}
}
//you can implement a method like this one for each EditText with the list position as parameter :
public String getValueFromFirstEditText(int position){
//here you need to recreate the id for the first editText
String result = textValues.get("theFirstEditTextAtPos:"+position);
if(result ==null)
result = "default value";
return result;
}
}
答案 2 :(得分:0)
试试这个
save.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
System.out.println("Save clicked");
for(int i = 0; i < listAdapter.getGroupCount();i++) {
String group = listAdapter.getGroup(i).toString();
for (int k = 0; k < listAdapter.getChildrenCount(i); k++) {
String child = listAdapter.getChild(i, k).toString();;
System.out.println("For i="+i+" and k="+k+" string value is="+child);
}
}
}
});
堆栈追踪:
10-14 16:19:38.877 20206-20206/stack.buy.com.stackdemos I/System.out: For
i=0 and k=0 string value is=Nokia1
10-14 16:19:41.395 20206-20206/stack.buy.com.stackdemos I/System.out: For
i=0 and k=1 string value is=Nokia2
10-14 16:19:45.015 20206-20206/stack.buy.com.stackdemos I/System.out: For i
i=1 and k=0 string value is=Apple1
10-14 16:19:47.663 20206-20206/stack.buy.com.stackdemos I/System.out: For
i=1 and k=1 string value is=Apple2
10-14 16:19:50.968 20206-20206/stack.buy.com.stackdemos I/System.out: For
i=2 and k=0 string value is=Samsung1
10-14 16:19:51.957 20206-20206/stack.buy.com.stackdemos I/System.out: For
i=2 and k=1 string value is=Samsung2
另外,对于自定义视图ViewHolder
策略很好
public class ExpandableListAdapter extends BaseExpandableListAdapter {
private Context _context;
private List<String> _listDataHeader; // header titles
// child data in format of header title, child title
private HashMap<String, List<String>> _listDataChild;
// private final HashMap<String, String, String> mCheckedItems;
String cat, item, quty, units, notes;
ArrayList<String> ss = new ArrayList<>();
public ExpandableListAdapter(Context context, List<String> listDataHeader,
HashMap<String, List<String>> listChildData) {
this._context = context;
this._listDataHeader = listDataHeader;
this._listDataChild = listChildData;
}
@Override
public Object getChild( int groupPosition, int childPosititon){
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.get(childPosititon);
}
@Override
public long getChildId ( int groupPosition, int childPosition){
return childPosition;
}
@Override
public View getChildView ( final int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent){
final String childText = (String) getChild(groupPosition, childPosition);
final ViewHolder holder;
View row = convertView;
if (row == null) {
LayoutInflater inflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.list_item, parent, false);
holder = new ViewHolder();
holder.mm = (LinearLayout) row.findViewById(R.id.entries);
holder.qty = (EditText) row.findViewById(R.id.qty1);
holder.note = (EditText) row.findViewById(R.id.note);
holder.unit = (Spinner) row.findViewById(R.id.unit);
holder.cb = (CheckBox) row.findViewById(R.id.cb);
holder.txtListChild = (TextView) row
.findViewById(R.id.lblListItem);
row.setTag(holder);
}
else {
// view already exists, get the holder instance from the view
holder = (ViewHolder) row.getTag();
}
final int grp = groupPosition;
holder.cb.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final CheckBox cb = (CheckBox) v;
if (cb.isChecked()) {
holder.mm.setVisibility(View.VISIBLE);
} else {
holder.mm.setVisibility(View.GONE);
}
System.out.println(ss);
}
});
holder.txtListChild.setText(childText);
return row;
}
/* public String recollect(int grp, int ch) {
cat = getGroup(grp).toString();
item = getChild(grp, ch).toString();
quty = qty.getText().toString();
units = unit.getSelectedItem().toString();
notes = note.getText().toString();
System.out.println("cat=" + cat + "; item=" + item + "; qty=" + quty + "; unit=" + units + "; note=" + notes);
return cat + ";" + item + ";" + quty + ";" + units + ";" + notes + "_";
}*/
@Override
public int getChildrenCount(int groupPosition) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.size();
}
@Override
public Object getGroup(int groupPosition) {
return this._listDataHeader.get(groupPosition);
}
@Override
public int getGroupCount() {
return this._listDataHeader.size();
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
String headerTitle = (String) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_group, null);
}
TextView lblListHeader = (TextView) convertView
.findViewById(R.id.lblListHeader);
lblListHeader.setTypeface(null, Typeface.BOLD);
lblListHeader.setText(headerTitle);
return convertView;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
// somewhere else in your class definition
static class ViewHolder {
EditText qty;
EditText note;
Spinner unit;
LinearLayout mm;
CheckBox cb;
TextView txtListChild;
}
}
喜欢,onChildClick如果你想要当前视图,那么你可以像这样访问:
EditText note= (EditText) v.findViewById(R.id.note);
String value = tv.getText().toString();