XML shape as layout background - android

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?

Related

Android How to create a Glowing Border or Four side shadow Rectangle Shape Background

I want to fill the background of multiple size (custom width or height) constraint layouts with this design:
Noticed that the outline border is glowing with fading gold color.
I have tried with the following:
Attempt (A) is using of ImageView tag, but not scalable to custom width and height.
Attempt (B) is xml created. But the border color is not fading, isn't the desired result.
Attempt (C) is using 9 patch file. The border radius and corner radius does not seems correct at all. (Would also like to know reason of this)
This is my 9patch file:
May I know if this is even possible to achieve?
Anyone please help.

How to clip semi circle at top center of ImageView(Android)

I need to clip a semi circle at top center of the ImageView like in the cd cover below
As I didn't worked on canvas in Android,I have no idea to achieve this!
You could use the following approach:
1) Create a Relative layout with 2 elements:
- A semi Circle shape
- You image
2) Align the semi circle on the image view
3) Make Your linear layout as a custom view (optional) else directly use it

How to flatten (opposed to rounding) button corners

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

image background like a frame using android drawable xml

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.

Gradient for border in Android

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.

Categories

Resources