Blur input on edittext - android

I am creating an app for users to hold the phone in a specific way - therefore one method i am testing is blurring an image depending on the phones position.
Now I want to let the user do a small task - write something to an Edittext and blur the text too --- sure I could display the textinput as textview on top of the image, but probably the users eyes are focused to the edittext and not the image/textview
So is there a possibility to blur the input within the edittext? An other possiblity would be to blur the complete view (combined with a lot of refactoring), but I would prefer the edittext solution..
Would be great if someone would be able to help me!

You can try and use the alpha property of it to reduce the opacity.
A similar answer that makes a custom TextView for it can also be seen here: https://stackoverflow.com/a/2904259/8118133
You can also look at adding a BlurMaskFilter if that does the job for you.

Related

ios8 like Vibrancy effect on Android

Has anyone tried the ios 8 like vibrancy effect to EditText and Bitmaps on Android?
https://github.com/ide/UIVisualEffects/blob/master/Screenshots/UIVisualEffects.png
PorterDuffXferMode looks like the way forward but I will be interested in knowing if anyone has actually tried this for different widgets like EditText, TextView, ImageView and Lists on Android? I am specifically referring to see through text visible through layers of background and blurred overlays. Also interested to know if anyone has been bold enough to roll out Android libraries already for this?

How to remove Text from image (.jpg/png) in android

sorry for bad English,
I want to implement the koreakoe song.
and i have 1 video for that.
so i can take each frame from MediaMetadataRetriever class in android.
in Bitmap format. and each bitmap contain one image and some text.
So my question is how to get this text on image and after remove this text from image or highlight each word on current image.
i have no such code that
please give me suggestion.
Please see the below image for example..
Then after
OR
if you some clarification please ask me.
Thanks in advance.
If you see some text in an image, that's not a separate object you can manipulate (i.e.: removing or highlighting a word).
Because that text is not a string. It's part of the bitmap itself.
It's a bunch of colored pixels over a bunch of colored pixels.
Thereafter, you can't easily remove it if not using a graphic editor or some AI techniques.
[EDIT]
A tricky solution would be to COVER the text with something else.
I.e.: a textView with an opaque background. There you will put YOUR text.
This can be easily achieved, by using a RelativeLayout.
I said it's TRICKY. Probably it's not the best visual solution, but it may help you solve the urgency.
[EDIT 2]
Another tricky solution would be to CUT the text potion of the image.
I.e.: you CROP the image at a specified amount of pixels.
Again, I said this is TRICKY, too. Probably it's not the easiest way, but it may result in a better visual rendering, allowing you to use a TRANSPARENT background for your text.
I think you should use an image without text and then lay the text over the image using a TextView. I hope it is then clear how to manipulate the text without changing the image.
As Bob Malooga already stated, there is no easy and flawless way to remove text that is actually part of the bitmap, so you should separate the image from the text.

How to add dynamic text entered by user to canvas in android?

I am making an app in which a user enters some text and that text has to be displayed on a rectangle on an image(like a notes-stick on the image, it can be dragged on the image and also re-sized). I am very new to android and i really can't find a way to do so in android through books and google.
I have been designing apps using html, in html we could just style a text-box like we want and add it anywhere on the page. But here i am unable to configure the edit-text to do the same. But i am unable to make the edit-text like a notes-stick and to make it draggable and re-sizable dynamically.
I also tried drawing just a rectangle using canvas.drawrect() ... but how to add text to that dynamically is something which i am unable to figure out.
I am not asking for the entire code ..but please guys give me a head-start to the right direction so that i can try things out and try to figure out a way.. Right now i am badly stuck.
The image below shows how the notes-stick should look like...
If you don't need it to be actually drawn on the canvas itself, using an EditText widget and having both it and your image in a RelativeLayout may be the way to go. You can set max height and width of the EditText, or have it wrap the height so it expands with the text, etc. Just make sure that the EditText widget gets added to the RelativeLayout after the image, so it is on top.

Android. Image in EditText

I wanna create a simple calculator. One from my goals its place in EditText field images with special math chars as like square root, pi... F.e. :
2/34*sqrt(121)
Here I want to place images instead of divide, multiply chars, sqrt string.
how I can do it?
Some more questions:
Does it actually need to be Editable i.e. user can type directly into it? If so how will it work? when they type '*' it will realize it and replace it with your png? Would it be acceptable if it didn't interrupt as they type but instead all at once when they are finished entering the entire line?
Best answer I have for now:
EditText doesn't support that by default. You'll likely have to create your own view that is some kind of mashup of EditText and LinearLayout that can hold ImageViews with your pngs. If it doesn't need to be editable by the user it is going to be easier because you can make your custom view a LinearLayout and add TextView's and ImageViews with the proper text and images set in them. If it does need to be editable it is going to a bigger challenge. You'll have to use a TextChangedListener to pull out each character as it is typed and replace it with an ImageView if need be. Seems to me like the hard part is going to be knowing where to position the ImageView and having the EditText know that you want it to pick back up with text on the other side of the Image. Im not sure how you'd go about that. Maybe the best solution is you have an EditText that they type into and then seperately you have your custom view as a display view. That way you don't have to worry about positioning images over the top of an EditText and correctly moving the cursor to right side of the image.
What I would suggest is looking into a freely available font that includes mathematical symbols (some quick searching turned up the StixFont project), then just add that font to your assets, and set it as your typeface. You'll still probably need a TextWatcher/TextChangedListener as Tim suggested (unless you're using your own keyboard to input the symbols) but this would get around the problem of trying to insert images into a text field, and would also keep the vector quality provided by fonts versus a raster image embedded into a text field.

Android TextView and how to determine the number of visible characters

How can I determine the number of visible characters that a TextView can display. For example if I change the orientation this number may change. If I change the resolution then also the number of visible characters changes.
Thanks in advance
Thank you for your answer.
Currently I am developing a small text based game to become acquainted with the Android API. For that reason I need to know exactly how much characters can be displayed in the visible area of a TextView widget. I saw an example of Paint but wanted to know if there are better solutions.
Ideally, you design your GUI such that it does not matter. For example, you can use android:ellipsize to deal with strings that are too long for the available space.
There are classes in the 2D drawing APIs (e.g., Paint) that seem to be tied into this, but it does not look like much fun.
You can use ellipsize property but there has been a bug that has been filed on the same
http://code.google.com/p/android/issues/detail?id=2254
On the bottom of this page you could find an alternate approach which can draw exactly the number of lines on a given space...

Categories

Resources