I am using MuPdf to display pdf file and its successfully implemented but now i want to get selected (highlighted) text?
Thanks in Advance.
Seems to me you have 2 problems, the first is to extract the text, which MuPDF can already do. There is example code for this I believe. Then you need to compare the co-ordinates of the highlighted area with the position of the text, and decide which text is within the highlighted area.
So the first part you have example code for, the second part is up to you, as its (presumably) your application that draws the highlight. THe last part is then your job, figure out which text is within the area.
Related
I want to add images in a text field/text form field in flutter. Whenever the user clicks the first button in the bottom navigation bar, the app will ask to pick an image and the image will display in the text field.
Like this:-
How Can I add one? (I am not talking about emoji)
ANY HELP OR IDEA WOULD BE APPRECIATED.
You can use RichTextEditor using rich_text_view plugin to support stylized text. Another option here is by using flutter_markdown to render images from Markdown.
I'm building am app that will allow Odometer entry. I would like to use the image shown below as the background on an EditText. Doing that is no problem, however I can not seem to get the digits entered into the text view to line up in the spaces of the image. I've tried adjusted the text size, font face, etc.
Here is the image I would like to use...
Does anyone have any suggestions on how I can accomplish this? So that when the user entered digits into the EditText, each digit goes into the correct "slot"?
thank you!!!
You can use android:letterSpacing? (only applies api 21 and over)
Set up 6 separate EditTexts on top of that image each with dimensions of the square they need to go into. Then set up event handlers so that it appears to be one fluid motion across EditTexts when the user enters data. Not very elegant but it'll work.
I have a text gathered from API and it consists of custom syntax. I display it using TextView but I need to render special part of the text and convert those text into elements. An example of a text is below.
Oh, that's great idea! Check (user: someuser)'s answer for this.
You can as well look at (ref: a forum post title) or:
(ref: another forum post)
This is a hint for you! (hint: should be displayed as a mini icon
but when clicked, a tooltip should be opened)
Here is a spoiler for you.
---- spoiler ----
some spoiler. this text should not be displayed directly but it should be
converted to a button element. When the button is clicked, this text should
be shown
---- spoiler ----
So, I need to convert (user: someuser) into a link in the view which will be shown as "someuser" but when clicked, it will open a new intent. For (ref: topic) keyword, it's the same. When I hit spoiler, I want to make it a nice button indicating that it's a spoiler and when user clicks, it will expand.
How can I parse this text and show correctly in a view? I don't have problem with parsing but my problem is displaying those elements in the view.
Methods I Tried
I tried WebView instead of TextView thinking that I can convert those into HTML/Js but the performance was terrible. Although I use RecycleView and ViewHolder, WebView is simply an overkill. I need to use some kind of a TextView but with the elements I would like to have.
I also looked at custom HTML tag handling with TextView (thinking I can convert those legacy tags into html) but I failed to see how I can insert button for spoiler tag or insert custom elements like tooltip for hint.
Thank you!
I'm working with Osmdroid, particularly with this class: http://code.google.com/p/osmdroid/source/browse/trunk/osmdroid-android/src/org/osmdroid/views/overlay/ItemizedOverlayWithFocus.java
It shows a ballon with text description when an item is tapped ('focused') but I want wo show the description of all items all the time.
Anybody had the dame issue yet of can perhaps give me a hint on what to change in the ItemizedOverlayWithFocus.java- class, probably the draw()- method to get that done?
You can do that without changing anything in the library source code:
Use multiple ItemizedOverlayWithFocus, and in each one, put only one overlay item.
Is it Possible to Display some text say a story, in an ANDROID app which also enables the user to select some text and perform some operations on that text..
the main idea is to display some text and when the user selects some text(a word or a sentence) i need to get that text for some further operation on that text.
we cant use text view as you cant select text in textview,and we cant use editview because the user should not be able to edit the contents of the text.
Why not display the text in a WebView and enable text selection?
It works pretty well in CodePad, which is open source so you can have a look at the code here.
My first try would be to display this text in a normal TextView. Then I would provide two or three buttons to implement the selection of a part of the text. For example 1 Button to start and end selection and 2 Buttons with arrows for increasing/decreasing the part of the selection.
To highlight the part of the text which is selected, I would for example color this part of the text in a different color.
Coloring of text can be either done by using Spannable or the HTML class.