Comments (6)
刚刚看了下,是 OPPO 手机对跟布局的 onTouch 事件监听不到,具体什么原因还不清楚
from hidekeyboard.
@sivan67 按文档使用1.1.0试下
from hidekeyboard.
不行的,应该是 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.
关于OPPO手机的问题我还真不太清楚,请问下你是在setContentView(R.layout.id)之后调用的HideUtil.init(context)吗?
from hidekeyboard.
@yingLanNull 是的,在其它手机上都是可以的
from hidekeyboard.
谢谢你的反馈,我后续会根据你的做法更新上去。
from hidekeyboard.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hidekeyboard.