简体   繁体   English

从其他活动返回后,android gridview不响应单击事件

[英]android gridview doesn't respond click event after back from other Activity

1.I set GridView OnItemClickListener at MyFragment 1.我在MyFragment上设置GridView OnItemClickListener

        noScrollgridview.setSelector(new ColorDrawable(Color.TRANSPARENT));
        adapter = new GridAdapter(getActivity());
        adapter.update();
        noScrollgridview.setAdapter(adapter);
        noScrollgridview.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                    long arg3) {
                if (arg2 == Bimp.SelectBitmap.size()) {
                    ll_popup.startAnimation(AnimationUtils.loadAnimation(
                            getActivity(), R.anim.activity_translate_in));
                    pop.showAtLocation(mBaseView, Gravity.BOTTOM, 0, 0);
                } else {
                    Intent intent = new Intent(getActivity(),
                            GalleryActivity.class);
                    intent.putExtra("position", "1");
                    intent.putExtra("ID", arg2);
                    startActivity(intent);
                }
            }
        });

2.I click the gridview item and into GalleryActivity . 2.我单击gridview项并进入GalleryActivity At GalleryActivity, I clcik the "Cancel" Button and go back to the MyFragment. 在GalleryActivity,我单击“取消”按钮,然后返回MyFragment。

3.When I back MyFragment interface, I can't click the grid item again. 3.当我返回MyFragment界面时,无法再次单击网格项。

 noScrollgridview.setSelector(new ColorDrawable(Color.TRANSPARENT));
    adapter = new GridAdapter(getActivity());
    adapter.update();
    noScrollgridview.setAdapter(adapter);
    noScrollgridview.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
                long arg3) {
            if (arg2 == Bimp.SelectBitmap.size()) {
                ll_popup.startAnimation(AnimationUtils.loadAnimation(
                        getActivity(), R.anim.activity_translate_in));
                pop.showAtLocation(mBaseView, Gravity.BOTTOM, 0, 0);
            } else {
                Intent intent = new Intent(getActivity(),
                        GalleryActivity.class);
                intent.putExtra("position", "1");
                intent.putExtra("ID", String.Valueof(arg2));
                startActivity(intent);
            }
        }
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 选择器不响应点击事件 - Selector doesn't respond to click event 从活动2(6.0.1 Android)返回活动1后,MediaBrowser.subscribe不起作用 - MediaBrowser.subscribe doesn't work after I get back to activity 1 from activity 2 (6.0.1 Android) 从android中的一个活动调用其他活动的点击事件 - Call Click Event of other activity from one activity in android 在子活动中按下返回按钮后,Android主要活动的元素不响应 - Android main activity's elements do not respond after pressing the back button from child activity 从背面查看不响应单击android - view from back does not respond to click android 意图返回活动后,android alertdialog 不显示 - android alertdialog doesn't show after intent back to activity Android按钮在动画后没有响应 - Android Button Doesn't Respond After Animation WebViewClient的Android后退按钮不会返回当前的Activity - Android back button from WebViewClient doesn't return to current Activity Android其他活动单击返回键到列表视图,列表视图项不能在选项卡下单击 - android other activity click back key to listview ,the listview item can't click under the tab 从另一个活动回来时,android setOnItemClickListener不响应 - android setOnItemClickListener not respond when comes back from another activity
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM