Android Text Display - Canvas.drawText() output pixelated - android

My Android app displays text in a few different ways, and there are some annoying differences between them I was hoping folks could help with.
When I use display methods that might be termed "automatic," the text is displayed very nicely. By automatic methods, I'm referring tools, like Toasts and Button widgets where I just have supply the text, and the OS (or "environment" or whatever) displays it for me. The letters are nicely curved, pleasant to look at, and easily legible.
However, in my code where I handle the text display (using Canvas.drawText() in a Surface Runner View), the text quality is poor. The text is still legible, but it looks pixelated. The letters just don't look their best.
I've tried experimenting with Paint.setTypeface(), using Typeface.SANS_SERIF for example, but the quality of the display when it's my code is always poor. Doable, but poor.
Has anybody else experienced this? By any chance does anybody have a solution?

You might also try playing around with Paint.setAntiAlias(boolean) or Paint.setSubpixelText(boolean).

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?

Issues designing Android UI in Xamarin

I am in the process of writing my first android app. I figured, for a simple exercise, I'd write an app to keep score in bowling.
I want to create a picture of the pins, with a touch toggling a pin between standing, and fallen. Then an ok button, that completes the shot. After each shot is entered, have a picture of the score updated.
Then, I want to be able to click on a frame, and edit it...mistakes happen.
This seemed simple enough. At least if I were to whip up something in HTML5 I would be done by now.
However, I'm struggling with just drawing the UI...ugh.
Would I just create the pins as image buttons? And how do I align them properly...I can't seem to drag stuff where I want, it's all left aligned and stacked. Nothing like it should look.
And how can I dynamically create images for buttons? At least that's how I was thinking I would do the score (showing all 10 frames with the shots and running score.
I realize this is a beginner question. But I've been at it for five hours, and I'm no farther along.
I don't think it's necessarily fair to compare your speed in a dev environment you are new to with one you already know - you are bound to be slower in the new one.
To get more familiar with android's XML layouts, I recommend you take a look through some of the tutorials on layouts - on linearlayout, gridlayout, relativelayout, etc which I think will have you quickly working in XML to generate your ui.
One such tutorial is http://slodge.blogspot.co.uk/2013/01/an-mono-for-android-wrappanelflowlayout.html
Once you've learnt a bit about the XML, I suspect you'll also find the designer easier too.
For the questions about the pins, well these sound a lot like checkboxes, only drawn differently - so check out:
Custom checkbox image android
http://vimaltuts.com/android-tutorial-for-beginners/android-custom-checkbox

Display ALT-219 █ in TextView on Android - Extended ASCII

I want to display a block character "ALT-219" in a TextView. It isn't easy to search Google or stackoverflow for this as block means so many other things but I tried. I experimented with saving the file as a UTF-8 and my entire project crashed in some unexplainable way, I went to backups, that crashed in even worse ways. I finally backed out of what I did and rebuilt so I am back to scratch but I am not inclined to experiment without asking for help.
What I am really trying to do is create a pseudo graphic meter so that I have different strings for different values like a gas gauge where there are different number of ALT-219 characters as the values change. This gives me a gauge 1/4 inch high on the screen that goes from one edge to the other and when the tank is empty, no ALT-219 and when full the entire line is full. Not really a gas gauge but I am just trying to explain it.
String ascii="\u2588";
quoteText.setText(ascii);
I did this way and it is working perfectly fine no crash.
Thanks :)

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...

Android - displaying fractions using unicode

I am trying to make a fraction:
I am using this is a text view but it is not rendering very nicely:
"5"+'\u2044'+"9";
It does not turn the text into a nice fraction instead it sort of covers part of the numbers and squishes them together.
Any solutions or alternatives?
Try:
tv.setText(Html.fromHtml("<sup>5</sup>/<sub>9</sub>"));
Don't know if that will look good, but it's worth a shot. Otherwise, other than the single-glyph fractions like 1/2, I suspect you either will need to go without or render it yourself.

Categories

Resources