Giter Site home page Giter Site logo

Comments (6)

sivan67 avatar sivan67 commented on July 19, 2024

刚刚看了下,是 OPPO 手机对跟布局的 onTouch 事件监听不到,具体什么原因还不清楚

from hidekeyboard.

yingLanNull avatar yingLanNull commented on July 19, 2024

@sivan67 按文档使用1.1.0试下

from hidekeyboard.

sivan67 avatar sivan67 commented on July 19, 2024

不行的,应该是 OPPO 手机的原因,我在 activity 中直接对 android.R.id.content 进行 onTouch 事件的监听都监听不到,我自己的解决办法是 HideUtil 中提供了另一个 init 方法

public static void init(Activity activity) {
        new HideUtil(activity, null);
    }

    public static void init(Activity activity, ViewGroup content) {
        new HideUtil(activity, content);
    }


    /**
     * @param activity
     */
    private HideUtil(final Activity activity, ViewGroup content) {
        if (content == null) {
            content = (ViewGroup) activity.findViewById(android.R.id.content);
        }
        content.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View view, MotionEvent motionEvent) {

                dispatchTouchEvent(activity, motionEvent);

                return false;
            }
        });

        getScrollView(content, activity);
    }

然后在 activity 中使用

HideUtil.init(this, mRecyclerView);

from hidekeyboard.

yingLanNull avatar yingLanNull commented on July 19, 2024

关于OPPO手机的问题我还真不太清楚,请问下你是在setContentView(R.layout.id)之后调用的HideUtil.init(context)吗?

from hidekeyboard.

sivan67 avatar sivan67 commented on July 19, 2024

@yingLanNull 是的,在其它手机上都是可以的

from hidekeyboard.

yingLanNull avatar yingLanNull commented on July 19, 2024

谢谢你的反馈,我后续会根据你的做法更新上去。

from hidekeyboard.

Related Issues (6)

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.