0

我是 stackoverflow 的新手,感谢您提供这样一个 grt 网站。我遇到了问题expandablelistview。我有一个imageview内部列表项,但每当我点击imageview什么都没有发生。我已经搜索了 stackoverflow 并得到了添加的建议

android:focusable=false
android:focusableInTouchMode=false
android:clickable=true 

因为imageview,当我单击时imageview没有任何反应,但是当我单击列表项然后在imageview它工作时,我对这种行为感到困惑。请你能告诉我它为什么会发生以及我在做什么错吗?

我的布局在这里

处理点击事件的代码:

                expListView.setOnChildClickListener(new OnChildClickListener() {

        @Override
        public boolean onChildClick(ExpandableListView parent, View v,
                final int groupPosition, final int childPosition, long id) {

            ImageView delete = (ImageView) v.findViewById(R.id.delete);

            TextView text_click = (TextView) v
                    .findViewById(R.id.lblListItem);

            text_click.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View arg0) {
                    Intent i = new Intent(getApplicationContext(),
                            Recitation.class);
                    i.putExtra("surah_index",
                            uniqueSurahs.get(groupPosition));
                    i.putExtra("ayah", aaa.get(childPosition).getAyah());
                    startActivity(i);
                }
            });

            delete.setOnClickListener(new OnClickListener() {

                public void onClick(View v) {
                    AlertDialog.Builder builder = new AlertDialog.Builder(
                            Bookmarks.this);
                    builder.setMessage("Do you want to remove?");
                    builder.setCancelable(false);
                    builder.setPositiveButton("Yes",
                            new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog,
                                        int id) {
                                    List<String> child = listDataChild
                                            .get(listDataHeader
                                                    .get(groupPosition));

                                    System.out.println("Surah:"+uniqueSurahs
                                                            .get(groupPosition));

                                    System.out.println("Ayah:"+aaa.get(childPosition+1)
                                                            .getAyah());

                                    bookmarkHandler
                                            .deleteBookmark(new BookmarkDAO(
                                                    uniqueSurahs
                                                            .get(groupPosition),
                                                            aaa.get(childPosition+1)
                                                            .getAyah()));

                                    //aaa.remove(childPosition);

                                    child.remove(childPosition);
                                    listAdapter.notifyDataSetChanged();
                                }
                            });
                    builder.setNegativeButton("No",
                            new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog,
                                        int id) {
                                    dialog.cancel();
                                }
                            });
                    AlertDialog alertDialog = builder.create();
                    alertDialog.show();
                }
            });

            return false;
        }
    });

感谢和问候伊姆兰

4

0 回答 0