Giter Club home page Giter Club logo

Comments (13)

Djek-grif avatar Djek-grif commented on May 28, 2024 1

In my case I try to add onClickListener for spinner and I've got the same problem. I've crated workaround with touch listener:

someSpinner.setOnTouchListener { _, event -> onTouchSomeSpinner(event)}

fun onTouchSomeSpinner(event: MotionEvent): Boolean {
        if(event.action == MotionEvent.ACTION_UP) {
            view.hideKeyBoard()
            view.analyticsEvent()
            ...
        }
        return false
    }

from dialogplus.

wood23636 avatar wood23636 commented on May 28, 2024

version 1.10

from dialogplus.

orhanobut avatar orhanobut commented on May 28, 2024

can you show the whole implementation of dialogplus?

from dialogplus.

wood23636 avatar wood23636 commented on May 28, 2024
           WheelView monthWheel = (WheelView)viewGroup.findViewById(R.id.month_wheel);

//
//
//
monthWheel.setScrollCycle(true);
NumberAdapter monthAdapter = new NumberAdapter(monthArray);
monthWheel.setAdapter(monthAdapter);
monthWheel.setOnItemSelectedListener(mWheelViewListener);
monthWheel.setUnselectedAlpha(0.5f);
monthWheel.setOnItemClickListener(new TosAdapterView.OnItemClickListener() {
@OverRide
public void onItemClick(TosAdapterView<?> tosAdapterView, View view, int i, long l) {

                }
            });

            DialogPlus dialogPlus = DialogPlus.newDialog(getActivity())
                    .setContentHolder(new ViewHolder(viewGroup))
                    .setGravity(Gravity.BOTTOM)
                    .setCancelable(true)
                    .setOnItemClickListener(new OnItemClickListener() {
                        @Override
                        public void onItemClick(DialogPlus dialogPlus, Object o, View view, int i) {

                        }
                    })
                    .create();
            dialogPlus.show();

from dialogplus.

orhanobut avatar orhanobut commented on May 28, 2024

When you use ViewHolder, you can't use OnItemClickListener, if you want to have click events of the individual views, use OnClickListener, or if you already handle it by yourself, just remove all click listeners from dialogplus.

from dialogplus.

wood23636 avatar wood23636 commented on May 28, 2024

yes I have removed all click listeners before. But it throw the exception too.

DialogPlus dialogPlus = DialogPlus.newDialog(getActivity())
                        .setContentHolder(new ViewHolder(viewGroup))
                        .setGravity(Gravity.BOTTOM)
                        .setCancelable(true)
                        .create();
                dialogPlus.show();

from dialogplus.

wood23636 avatar wood23636 commented on May 28, 2024

I think that, when I give a custom viewgroup, the dialogplus also set the click event all children. But when I set a spinner in it. spinner can not set click event. android throw a exception. Can I forbidden the click event?

from dialogplus.

orhanobut avatar orhanobut commented on May 28, 2024

Yes, it seems this is the exact reason and unfortunately there is no this option, but we should add this for these situations. You can only avoid this by creating spinner dynamically, dialogplus adds clicklistener only if the view has an id.

from dialogplus.

wood23636 avatar wood23636 commented on May 28, 2024

oh! may be I can remove the id and try find it by the tag or parent find chid?

from dialogplus.

orhanobut avatar orhanobut commented on May 28, 2024

That could also work but out of box, we already avoid to set clicklistener for adapterview. Need to check thorougly for this issue.

from dialogplus.

wood23636 avatar wood23636 commented on May 28, 2024

ok. I try to remove the id and get it work. Thanks.

from dialogplus.

orhanobut avatar orhanobut commented on May 28, 2024

cheers 👍

from dialogplus.

bigggge avatar bigggge commented on May 28, 2024

@wood23636 Can you show me your code,I can't solve it, Thanks.

from dialogplus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.