I know how make the four edges of a button rounded using a drawable shape, but can one make the corners flat, such that the button will look like it has 8 edges (like an ocotogon)?
You can use
Yuor_button.setBackgroundDrawable(//something);
This "something" can be an image of octagon or you can try using Android Shape Drawables Tutorial
Related
I want a cardview to look like as in the image below. How to a create shape with rectangle with elongated botton right corner in the drawable and apply it as a background to a cardview? OR is there a better way to achieve this result?
I need to create an imageview with background drawable like a frame but not getting the required design.
I'm getting these images
But the required designs are
In your layout, set the background to the required colour.
android:background="#FFF9C4"
Then add the ImageView inside the layout and add padding on Left, Right, Top and Bottom of size as per requirement.
You can explore shape too, using shape you can control the corners as well.
I'm wondering if that's possible to create an effect as shown at the picture below using only 1 Layout. The "Description" is a separate TextView and not related to the question. So basically I need a rect shape with:
Glowing border (stroke and shadow..?)
Middle rectangle with gradient
Outer rectangle
Any ideas if this could be achieved using only one Layout and XML shape as background?
I have a button say myButton. I want to set the top left corner radius of the button programmatically.
I'm looking for something like
myButton.setTopLeftCornerRadius(10);
I have looked for a method like 'setcornerradius' in eclipse but got nothing.
You can use shape drawable for this or rounded corner background Image.
For shape drawable detail please see this post.
How to set corner radiuses for the button in java code?
Cheers.
Button is type of View and all Views in Android occupy rectangular areas. However, you can set the background of the button to any image you like. Like a Shape Drawable with round corners.
Try this code for draw the rounded corners edittext:
How to create EditText with rounded corners?
I have some text in a relative layout.I know that we can draw a border with curves using stroke and corner in a separate xml.
Is there a way to apply gradient effect for the border constructed with the stroke? or is there any other way to draw a gradient border?
Thanks in advance.
I don't know of a way to do that trivially, but it seems like you could define two shape drawables and combine with a layer drawable. The bottom one would be a rounded corner rectangle with a gradient, the top one would be a slightly smaller rounded corner rectangle of whatever you wanted the interior color to be. The effect should be something like a stroke gradient, although I haven't tried it.