Overlapping Text on Button - android

I'd like to create a button for a calculator with normal and secondary text on it. The picture below outlines it pretty succinctly. My main concern is getting the secondary text to scale well on different devices. This makes me think that I want to use a secondary text view, or find some way to use HTML to render the button secondary text in the button.
The problem I'm running into is that I have no idea what the most scalable and robust way of doing this is.
Is it necessary to create a custom button? Or is there some way to get the button's setText() with HTML.fromHTML() to place the secondary text at the top left corner? So far adding more lines makes the button stretch, and adding specific padding for the button doesn't scale to other devices. I assume a background 9 patch image using the secondary text won't work either, as larger buttons won't scale the secondary text.
Anyone have any pointers? Thanks!

Related

use two separate spaces in an image as a button in android

Is there any solutions for this problem :
I want these two shapes with blue and pink colors to be separate buttons so whenever the pink space is clicked something happened and the same for the blue space.
PS: i can slice the two portions and create an ImageButton for each but the problem is the button doesn't take the same shape of a portion it is always rectangular so i can't place the other button next to it
I'd suppose to recommend you to write a custom View, that draw this picture itself, depending on some kind of formulae.
Or use an old method of game development when you define color of pixel that was touched or focused.
Define color of pixel touched
PS: i can slice the two portions and create an ImageButton for each but the problem is they don't fit good on the activity
Try to use 9 patch resources or svg drawables instead.
If they are defined well it should work.
Then you will have to write you're own custom button the uses them.
You can read more about it here:
http://www.vogella.com/tutorials/AndroidDrawables/article.html#9-patch-drawables
http://www.vogella.com/tutorials/AndroidDrawables/article.html#vector-drawables

Android border around textview just on the base and partially on the right and left walls

I need to get a border on the base of my android text view, it should look something like the count down -1:29 timer. I know I can create a image and put it on the background, but I need it to be a layout xml kinda thingy so that it adjusts with size of the text within for all phones.
Use a 9-patch image that can stretch horizontal and place it as a background. That is all you need.

Large Text Shadow on Android

I have an app where I am trying to add text shadow to a TextView. The problem is: the shadow is always very thin. I'd like it to be thicker.
I am trying to generate "memes", as some of you might know from the "fun sites" on the internet. My goal is something like this font:
http://d24w6bsrhbeh9d.cloudfront.net/photo/4324188_460s.jpg
I am using the same exact font, Impact. The problem is, when I add a black border shadow, the shadow is not visible enough and it's not wide enough. It's barely barely noticeable.
I am defining a FrameLayout, with the picture on the bottom and two text fields, one on the top and one on the bottom. The shadow is barely visible for both of them.
I have been using the parameters, shadowDy, shadowDx, etc. I know the shadowRadius is the parameter that actually defines the border size, but I have been experimenting both with values above 1 and below 1, and I can't seem to get any good results. There are minimal changes in size and shadow density, but nothing useful.
I have considered another option, which is a last resort, which is drawing the text twice, a bigger black font in the BG and align the character spacing so that the black text becomes the shadow of the white text on the front.
Thank you in advance !
You won't be able to accomplish that effect with the basic TextView shadows. I'd look at adding a stroke instead:
https://stackoverflow.com/a/2151964/321697
http://developer.android.com/reference/android/graphics/Paint.Style.html

Android - do I need transparent images for header, or with text already on the images?

I am trying to create a header navigation for my app. I want to get rid of spaces between the buttons, and as I understand it, I need to set images as the background.
My question is whether the images should contain the text on them, or be transparent, and I would just put the text on the buttons by the text field in the layout of that button?
Thanks!
You can have it both ways, but I'd recommend setting the text on the images it saves you space and allows more room for change in case you wanna change a word you dont have to edit the image.
And most importantly you let android auto scale you text to fit screen size( if you set to sp of course )

Android market like button using layouts and xmls

Could someone point me to links and/or ideas on how to design a button similar to the android market "Install Button" using XML alone. i don't want to create something from gimp / photoshop and use it as android:src.
Please reference to the picture below from
http://howto.cnet.com/8301-11310_39-57329887-285/get-the-ice-cream-sandwich-keyboard-on-your-android-phone/
If you notice the installed button it has a white rectangle stroke, black rectangle border, filled with blue.
[Note: the above picture does not belong to me, and link has been pasted indicating the copyrighted owner. The picture has been quoted as reference solely for the purpose of demonstrating the "installed" button and nothing else]
You can do that with a linear layout with a white background, and a button with blue background inside. Give smaller values for button size, so it fits inside to leave some space so white borders are shown. User a selector for button, to change it's color in different states. More about selector here

Categories

Resources