After a few months off, HenCoder is back.
This episode is about the last part of customizing a View: touch feedback. The concept of touch feedback is simple, but the internal logic is complicated, which often confuses developers and makes people unable to learn it because there is too much logic to get around. Therefore, I made a long video to explain the principle and break down the most essential things, hoping to make you more comfortable to absorb. It took five days to make the video, more than 12 minutes in total, which is all about some of the most core logic and principles of touch feedback.
Details on the contrary did not speak too much, because of this aspect of the details of the article, the Internet has a lot of, and many are written very well.
With that said, here’s the video:
If you can’t see the video, click here to see the original video.
Conclusion:
The key to customizing touch feedback:
- rewrite
onTouchEvent()
Write your touch feedback algorithm in there and return ittrue
(the key isACTION_DOWN
Event returntrue
). - If it is, there will be touch conflict
ViewGroup
And I need to rewrite itonInterceptTouchEvent()
Is returned at the beginning of the event streamfalse
And returns once when the takeover event stream is confirmedtrue
To achieve interception of events. - When the child View temporarily needs to organize the parent View to intercept the event stream, the parent View can be called
requestDisallowInterceptTouchEvent()
Notifies the parent View that it is no longer trying to pass in the current event streamonInterceptTouchEvent()
To intercept.
HenCoder Plus
I’m also announcing a new project of mine today: HenCoder Plus.
Unlike HenCoder, HenCoder Plus is not an elite technology sharing program, but a systematic teaching program. People’s skills are often uneven. Some aspects are already strong, but others are still weak. These weaknesses often limit the development of skilled people after a certain height. HenCoder Plus aims to focus on some of the most common and critical technical shortcomings in a short period of time, help people in need of rapid improvement, and make their “technology barrel” more balanced.
To keep things going smoothly, HenCoder Plus had a few days of quiet publicity beforehand, and now has close to 30 people involved. If you are interested, you can scan the QR code below, or visit http://plus.hencoder.com directly to learn more.
Said two
- Had better have certain development experience to sign up again, the proposal is at least one year above. Because HenCoder Plus is a paid teaching program for experienced people, I don’t want to waste your money.
- HenCoder will continue to update the way I’m used to, with low frequency and high quality.