无法在expandablelistview中单击imageview

时间:2013-08-27 20:50:27

标签: android android-layout expandablelistview expandablelistadapter

我是stackoverflow的新手,感谢这样的grt网站。我遇到了expandablelistview的问题。我有一个imageview内部列表项,但每当我点击imageview时都没有任何反应。我搜索了stackoverflow,并建议添加

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

对于imageview,当我点击imageview时没有任何反应,但是当我点击列表项然后在imageview它工作时我会对此行为感到困惑。请你告诉我它为什么会发生,我做错了什么。

我的布局是here

处理点击事件的代码:

                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;
        }
    });

谢谢和问候 姆兰

0 个答案:

没有答案