How to create a button like that in Android - android

Is there a simple way to create a button that looks more or less like that in Android, using margins or something similar ? (I do not whant to create Bitmaps)

Is there a simple way to create a button that looks more or less like that in andorid
Yes create an image resource (png file perhaps) that looks like that and set it as the background of the Button.
(I do not whant to create Bitmaps)
I am not entirely certain what you mean by not wanting to create bitmaps. But if you mean that you don't want to use an actual image file, then it might help if you could explain why you don't want to. But If this is the case no, there is not "a simple way" to do it. You'd have to manually create xml shape objects that make the grey 'L' shape and then perhaps use some custom font to create the letters. Then you'd have to adjust padding/margins until it lined up how you want (keeping in mind it may look different on different devices)

Related

Creating a Button looking like a "L"

I am currently working on an app where the UI is really important. So, I need to create a Button with a particular shape. I'd like to create one so my UI could look like this :
I saw several tutorials about creating your own drawables, but here my problem is the particular shape of my input. The "L" form bothers me ..
Any idea ?
I keep looking for a solution, and if I find one I will post it here as an answer.
You can either use an image of the shape you required or you can use 2 views places horizontally to each other. The first view will contain the yellow color as background with rect footstep image and another view with half of the height of first one having yellow background will be on the right of the first view.
P.S :
You can always use canvas to create your own views.
___________
|.....|.B....|B...|
| G.|____|.....|
|.....|........|.....|
|.....|.G__|.....|
You can't create a view like this BUT you can create a rectangle View like an ImagView that contains drawable like L. All you have to do is use VectorDrawables. create an SVG Image and then Convert it to a VectorDrawable by using Plugins like SVGVectorDrawable.
here is how to add plugin to your AndroidStudio
After All set the drawable to your Views Background.

Android: 9-patch image vs Shape vs Multi icon

Some people from our company create some rule about UI design for Web, Android and iOS. They give us a bunch of icon for each platform. But when i look at Android platform icon, they using multi icon to create 1 icon. For example, button background, they use these 3 icon, 1 for left side, 1 for right size and 1 stretchable for middle.
I think this is how web normally design button background. But i don't think i should do the same for Android (Maybe iOS also don't do it this way but since i only work with iOS for a short time, i not really sure). Normally i would use a Shape or 9-patch drawable for this kind of background. So here i have 2 question:
Which 1 should i use for button background in this example. A shape? A 9-patch drawable? Or multiple icon like this? And which one is worst to use?
If i must have to use multiple icon like this, how to put multiple icon like them into single background?
If their way of doing thing here is incorrect, i need some good reason to talk to them and make them change their mind. So any1 please help me clear about this problem.
Thank you!
9-patch should be the first choice and then is shape. Don't use 3 icon.
9-patch is more easy to use and easy to change if the further design changes. When using shape, you need to define the corresponding XML. If in next version, the background color changes, you need to modify the XML, but with 9-patch you just need to replace the resource file.
The other benefit is that, 9-patch can be created in UI side, programmer's don't have to re-manipulate it if the resource is correctly created. But with shape, programmer needs to know the RGB color, and need to code the XML.
3 icon is not suitable here. First, you have other better options. Second, 3 icon means you need to create 3 views for each of them. Third, the button should have different effect when user click it, with other two options you can simply define selectors, but with 3 icon, there's no elegant solution.

How to create round shape image using android?

I am having four piece of image.
Here I attached one sample image.
How can I create the round shaped image using these type of images?
Which layout is best for creating the UI for android?
Thanks in advance.
are you talking about something like this..
http://www.baijs.nl/tinycircleslider/
And for designing the UI for Android is depends on our requirement.it means whether you want to design something looks like rows and columns then GridLayout and tableLayout will be better,depends on requirement and look the layout will changes once try it your self and choose the best suited for your applicaiton.All the best Mate
inside relative layout add four imageview with attrs ParentTop, ParentRight, ParentBottom and ParentLeft. every image is rectangular with transparent extra area.
i can understand it is little hard to visualize on first attempt.
now come to click area. so a runtime decision about ignore transparent area click will be right thing.
more tricky way will be manage flags for all listeners and if two listener get calls its transparent area .

Android Creating Custom Buttons

I have quite a few buttons in my application, they vary in sizes based on the text inside. I want to customize the buttons but I am not sure if I should use
A) Ninepatch pngs
B) Android xml created
C) Photoshop pngs
I want the buttons to scale nicely and therefore not look distorted based on screen size. What are the positives and negatives of the above methods? Is there an ideal way to go about this?
It depends on what they should look like. Rounded corners? Complicated images? Drop shadows? Plain colors?
If you want simple buttons that are monotone in color, xml drawables are the best solution. You can do rounded corners through xml, so if plain is what you are looking for this is the best option.
If you are working with an image, then a 9 patch is the way to go. Play around with the draw9patch tool that comes with the sdk to get the hang of it. You also don't necessarily only need to leave the corners in tack, sometimes you may want to break up the resizable area depending on the image.
PNGs are the last resort as they are the least flexible of the 3 options.
By the way, you should also consider using a state list for all of your buttons, regardless of how you implement the drawable that the button uses. See the link below:
http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList

Does Android layouts work like HTML/CSS layouts?

I have created a button in Photoshop and I have split them into 3 images. Now I want to put those images into android button. I know how to create layouts in android but the point I am missing is how can I make them fluid?
So there is a button for which I have 3 images.
I now want to ask how can I use these images for a <Button> tag so it expands repeating the middle one. Do I need to create style here and then put background="#drawable/three_button_style" or there is something I really need to know?
Is the same going to be true for ListView? I got a list view and images for top, middle and bottom so can I create a ListView of 3 images repeating the middle one?
For scaling items Android usually uses 9-patch, which behaves something like your example but also vertically. Here's a link to the 9-patch tool that can be used to draw these:
http://developer.android.com/guide/developing/tools/draw9patch.html

Categories

Resources