各グループアイテムにボタンがある拡張可能なリストビューがあります。ボタンのクリックとアイテムのクリックを区別する方法はありますか?そのボタンをクリックしてリストを展開したい。アイテムをクリックしてアクティビティを開く間
どうもありがとうございます
編集:詳細説明
これが私がやろうとしていることの大まかなもので、今はExpandableListViewの使用を考えていますが、その方法がわかりません。
ご覧のとおり、グループ行には矢印(カスタマイズされた矢印)とテキスト部分の2つの部分があります。ユーザーが赤い部分をクリックすると、展開したい(通常の展開可能なリスト)。ユーザーが緑の部分をクリックすると、アクティビティに移動します。
どうか、どのように考えてください!

注:この質問は、以前は@snakeから質問されていました。同様の質問があるので、それをコピーします。
拡張可能なアダプタを設定するためのコード:
mGroupCollection = new ArrayList<GroupEntity>();
    //
    // for (int number = 0; number < list_related.size(); number++) {
    // System.out.println("the index of the gi"+number);
    // GroupItemEntity gi = ge.new GroupItemEntity();
    //
    // gi.Name = list_related.get(number);
    // System.out.println("to check index value"+gi.Name);
    // ge.GroupItemCollection.add(gi);
    // }
    //
    // mGroupCollection.add(ge);
    //
    for (int number = 1; number <= 6; number++) {
        GroupEntity ge = new GroupEntity();
        switch (number) {
        case 1:
            ge.Name = "MY LEARNING OPTIONS";
            break;
        case 2:
            ge.Name = "MY CAREER TOOLS";
            GroupItemEntity gi_c1 = ge.new GroupItemEntity();
            gi_c1.Name = "Career Options";
            ge.GroupItemCollection.add(gi_c1);
            GroupItemEntity gi_c2 = ge.new GroupItemEntity();
            gi_c2.Name = "Salary BenchMark";
            ge.GroupItemCollection.add(gi_c2);
            GroupItemEntity gi_c3 = ge.new GroupItemEntity();
            gi_c3.Name = "Reading List";
            ge.GroupItemCollection.add(gi_c3);
            break;
        case 3:
            ge.Name = "MY JOURNAL";
            GroupItemEntity gi_j1 = ge.new GroupItemEntity();
            gi_j1.Name = "NoteBook";
            ge.GroupItemCollection.add(gi_j1);
            GroupItemEntity gi_j2 = ge.new GroupItemEntity();
            gi_j2.Name = "Calendar";
            ge.GroupItemCollection.add(gi_j2);
            GroupItemEntity gi_j3 = ge.new GroupItemEntity();
            gi_j3.Name = "Favourites";
            ge.GroupItemCollection.add(gi_j3);
            break;
        case 4:
            ge.Name = "EVENTS";
            GroupItemEntity gi_events = ge.new GroupItemEntity();
            break;
        case 5:
            ge.Name = "PRESS RELEASE";
            GroupItemEntity gi_press = ge.new GroupItemEntity();
            break;
        case 6:
            ge.Name = "ABOUT";
            GroupItemEntity gi_about = ge.new GroupItemEntity();
            break;
        }
        mGroupCollection.add(ge);
    }
    // ge.Name = "commnets";
    adapterexpand = new ExpandableListMainFragmentAdapter(getActivity(),
            lv, mGroupCollection);
    System.out.println("I reached here in case" + adapterexpand);
    lv.setAdapter(adapterexpand);
グループクリックの展開可能なリストの私のコード:
  lv.setOnGroupClickListener(new OnGroupClickListener() {
        @Override
        public boolean onGroupClick(ExpandableListView parent, View v,
                int groupPosition, long id) {
            String planet = adapterexpand.getGroupValue(groupPosition)
                    .toString();
            System.out.println("this is from details" + planet.trim());
            //Fragment newContent = null;
            switch (groupPosition) {
            case 0:
                Intent intentcourse = new Intent(getActivity(),
                        LearnMainActivity.class);
                startActivity(intentcourse);
                break;
            case 1:
                //Intent intentcareer = new Intent(getActivity(),
                        //CareerToolMainActivity.class);
                //startActivity(intentcareer);
                break;
            case 2:
                break;
            case 3:
                Intent intentevent = new Intent(getActivity(),
                        EventsMainActivity.class);
                startActivity(intentevent);
                break;
            case 4:
                Intent intentspeech = new Intent(getActivity(),
                        SpeechMainActivity.class);
                startActivity(intentspeech);
                break;
            case 5:
                //newContent = new ColorFragment(android.R.color.black);
                break;
            }
            return false;
        }
    });
これが子クリックの処理方法です:
    lv.setOnChildClickListener(new ExpandableListView.OnChildClickListener()
    {
        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int group_position, int child_position, long id)
        {
        if (group_position==2)
        {
            //Fragment newContent = null;
            switch (child_position) {
            case 0:
                Intent intentcourse = new Intent(getActivity(),
                        NoteBookMain.class);
                startActivity(intentcourse);
                break;
            case 1:
                Intent intentcal = new Intent(getActivity(),
                        SimpleCalendarViewActivity.class);
                startActivity(intentcal);
                break;
            case 2:
                break;
            case 3:
            case 4:
            //  newContent = new ColorFragment(android.R.color.white);
                break;
            }
            System.out.println("clicked parent " + group_position + " child "
                    + child_position);
        }
            return false;
        }
    });