I want to create a custom shaped button like below in android with xml(I know I can do it with the image but it isn't one of my options),how to do this?
I started with the rectangle shape and then tried to play with the corners in negative way to make the right side raise but I was unsuccessful.
You should use a 9-patch (resizable drawable) as your button background, read this.
Related
I'm trying to create a shape for Button that would have one side round and other right side slop , the actual image and a shadow.
I'm tried alot but i'm not understand how to draw it and how to draw shadow for same.
Thanks in advance.
Design the shape whatever you want in any designing tool, export it as SVG. Then, in android studio right click on "drawable" folder -> new vector asset, then choose the exported SVG file from your local disc.
Now you can able to set the created drawable as button background.
Here is the information about custom buttons. In a different approach you can use canvas and onClickListener.
Is it possible to make layered button in Android with transparent icon throgh first layer? It looks tricky, I could make different assets but is it possible to achieve it programmatically? Example below
EDIT: Icon has no background, only border.
Seems easy enough. Save the icon as a .png file, such that anything besides the arrow outline is transparent. Then it's a simple matter of drawing one ImageView on top of another ImageView, depending on what you want.
In order to tint the arrow, use a TintableImageView as described here.
I am attempting to create a shape to "border" a button (linked below with the asterisk inside). I have a rounded button to the right that I have I already created, but have become stuck trying to create the other shape.
I have had many attempts at this, but none seem to work and it's incredibly frustrating.
Just to note, that the shape I want is currently a TextView and houses a number "1:" through to "4:"
Any help at all will be appreciated.
Image of what I am attempting to achieve:
i want to make a breadcrumb for my android app.
In breadcrumb on the left there is an imagebutton with arrow border. On the right there is a text title. When user tap on imagebutton, application performs specific task.
So, can you help me to create imagebutton with arrow border like in attach image?
Thank you.
I'm not 100% sure what you mean by an Arrow Border, but you cannot (as far as I know) set borders to any views in Android.
There are two options you could go for:
Make an outer View to surround the View you want a border on. Then set the background of the outer border to an arrow background.
Use a Nine Patch.
I would recommend a nine patch for this personally.
Edit: I noticed you wanted a border on an image. That could be an issue with nine patch unless you integrate the border into the image, which defeats the purpose.
I wounder how its possible to make a shape like the example, with round corners and padding from the screen borders, and also put text inside, how is this possible?
You can either use image buttons that contain image background with e.g. rounded corners or draw your own shapes, Android Shapes.
Using ImageButton you can define hover, focus and default state of a button and appy a background image to each state.
Here is a small code example with source, tutorial.