如何在ExpandableListView的SubItem中获取RadioButton - Android

时间:2013-04-23 17:20:44

标签: android listview expandablelistview

当当前视图只是主要布局视图时,如何在我的ExpandableListView中的子项目中获取我的自定义RadioGroup: 我有 - mainListView.xml // expandableListView
       - group_row.xml // textView
      -child_row.xml //具有自定义radioButton

 public void onCreate(Bundle savedInstanceState) {
    try{
         super.onCreate(savedInstanceState);
         setContentView(R.layout.mainListView);

      ExpandableListView elv = (ExpandableListView) findViewById(R.id.expandableListView1);
      SimpleExpandableListAdapter expListAdapter =
                new SimpleExpandableListAdapter(
                        getApplicationContext(),
                        createGroupList(),              // Creating group List.
                        R.layout.group_row,             // Group item layout XML.
                        new String[] { "Group Item" },  // the key of group item.
                        new int[] { R.id.row_name },    // ID of each group item.-Data under the key goes into this TextView.
                        createChildList(),              // childData describes second-level entries.
                        R.layout.child_row,             // Layout for sub-level entries(second level).
                        new String[] {"Sub Item"},      // Keys in childData maps to display.
                        new int[] { R.id.grp_child}     // Data under the keys above go into these TextViews.
                    );
                elv.setAdapter(expListAdapter);       // setting the adapter in the list.

        }catch(Exception e){
               System.out.println("Errrr +++ " + e.getMessage());
        }


    answersGroup = (SegmentedRadioGroup) findViewById(need this from child_row); 
    answersGroup.setOnCheckedChangeListener(this);

}

1 个答案:

答案 0 :(得分:0)

您可以扩展SimpleExpandableListAdapter类并覆盖

@Override
getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)

获取视图组?

相关问题