2017-09-29 4 views
-8

ExpandableListViewアイテムをクリックして新しいアクティビティを開くには?どのようにclik ExpandandableListView

enter image description here

+1

SOへようこそ。 ** child **アイテムでclickイベントを発生させたいと思うかもしれません。あなたは?チュートリアルを検索するときはGoogleを使用してください。 –

答えて

0

このコードを使用し

// setOnChildClickListener listener for child row click 
simpleExpandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { 
    @Override 
    public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { 
     //get the group header using groupPosition); 
     //get the child info using childPosition); 
     //display it or do something with it 
     Toast.makeText(getBaseContext(), " Clicked on :: " + groupPosition 
       + "/" + childPosition, Toast.LENGTH_LONG).show(); 
     return false; 
    } 
}); 

// setOnGroupClickListener listener for group heading click 
simpleExpandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() { 
    @Override 
    public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) { 
     //get the group header using groupPosition); 
     //display it or do something with it 
     Toast.makeText(getBaseContext(), " Header index :: " + groupPosition, 
       Toast.LENGTH_LONG).show(); 

     return false; 
    } 
});