如何在listview中找到子控件

时间:2022-04-21 18:50:00
 在listview的点击事件中找到子控件:
final int count1 = list.size(); // 获取子条目的个数
listView1.setOnItemClickListener( new OnItemClickListener() {

       @Override
       public void onItemClick(AdapterView<?> parent, View view,
                   int position, long id) {
             for ( int i = 0; i < count1; i++) {
                  View view1 = parent.getChildAt(i);
                  TextViewtv = (TextView) view1.findViewById(R.id. tv_pop_baoxian );
            }
            
      }
});
-------------------------------
在listview中找到子控件:
ListViewlistView1 = ( ListView)popupWindow_view
            .findViewById(R.id.pop_listview_bx);
for ( int i =0;i<listView1.getChildCount();i++){
      LinearLayoutlinear = (LinearLayout) listView1 .getChildAt( i );
      EditTextedit= (EditText) linear.findViewById(R.id.ed_baoxian_carPrice);
}