如何在android中使用Ontouchevent突出显示此pdf页面
这里我想使用android中的onTouchevent突出显示这段文本
Here I want to highlight this text using onTouchevent in android
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 OnTouchListener 来获取事件的 x 和 y。然后将屏幕绘制为位图,并根据字母的左上角显示和字母的大小使用bitmap.getPixel,看看它旁边的下一个字母是否也不是空格。最后,放一个黄色白色和黑色字母之间的矩形或您希望突出显示的矩形。
You could use OnTouchListener to get the x and y of the event. Then drawing the screen to a bitmap and using bitmap.getPixel based on the top left display of the letter nd the size of your letters, to see if the next letter(s) next to it are also not spaces.Finally, put a yellow rectangle in between the white and the black lettering or the ones you wish to have highlighted.
您必须为按钮或任何您想要的视图实现 onTouchListener。
如下所示:
实现 OnTouchListener:
然后实现查看触摸操作的代码:
现在添加用于打开 pdf 的代码到相应的操作中。
请参阅打开的 pdf 示例:
希望它会对您有所帮助。如果没有,请告诉我。
You have to implement the onTouchListener for the button or any view you want.
as like below:
implement the OnTouchListener:
Then implement the code for view touch action:
Now add the code to open the pdf in to respective action.
See this Example for the open pdf:
Hope it will helps you. If not then let me know.