简体   繁体   English

如何在Android中将离线词典与pdf阅读器集成

[英]how to integrate offline dictionary with pdf reader in android

我正在开始开发自己的带有字典支持的应用程序pdf阅读器,但找不到找到将离线词典与pdf阅读器集成的有用方法。

From what we discussed in comments, here is a posssibely solution: 根据我们在评论中讨论的内容,这是一个可能的解决方案:

The most difficult should be the pdf reader implementation. 最困难的应该是pdf阅读器的实现。 As you told me, you have found an open access pdf reader for android, so it is fine. 正如您告诉我的那样,您已经找到了适用于Android的开放式pdf阅读器,因此很好。

In order to implement an offline dictionary with your existing pdf reader, I suggest you this: 为了使用您现有的pdf阅读器实现离线词典,我建议您这样做:

1. Modifie your pdf reader to catch a word click (or long click). 1.修改您的pdf阅读器以捕获单词点击(或长按)。 You have to be carreful with that because I don't know how you implemented the pdf scroll. 您必须对此保持警惕,因为我不知道您是如何实现pdf滚动的。 So the system hould be able to distinguish if the user is trying to scroll, zoom the pdf, or to click a word in order to see the definition. 因此,系统应该能够区分用户是要滚动,缩放pdf还是单击单词以查看其定义。

2. Once you can catch the word click, you wil have to use the clicked word and search in your offline dictionary. 2.一旦可以捕获到单词单击,就必须使用所单击的单词并在离线词典中进行搜索。 for that, create a SQLite database: see: http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html and search for the clicked word. 为此,创建一个SQLite数据库:请参阅: http : //developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html并搜索单击的单词。

3. Once the results obtained, you can display your result in a dialog or another view, or even in your pdf reader if you implement this function. 3.获得结果后,如果实现此功能,则可以在对话框或其他视图中显示结果,甚至可以在pdf阅读器中显示结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM