How to clip semi circle at top center of ImageView(Android) - 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

Related

How to make cardview background as a shape of a rectangle with elongated botton right corner

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?

Android create item in GridView with round corners and ImageView

I have a GriView in which every element is a card with rounded corners. At the top of it there's an ImageView loaded from the net. I would like to fit the image inside the card so that it will have the top corners rounded. I've tryied with layer-list background, but no result.
Is there anyone who can give me some hints?
Thanks in advance
I found a solution: just put a rounded imageview (rectangle with rounded corners) behind the opaque relative layout (with same amount of rounded corners only in the bottom) and then set a negative bottom margin in the imageview, so that it will be covered for nearly 5 px by the relative layout
you can use this lib
and set this parameter for it:
<com.joooonho.SelectableRoundedImageView
...
app:sriv_left_top_corner_radius="16dip"
app:sriv_right_top_corner_radius="16dip"
app:sriv_left_bottom_corner_radius="0dip"
app:sriv_right_bottom_corner_radius="0dip"
...
app:sriv_oval="false" />

XML shape as layout background

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?

Android shadowed bottom border

I want to know can I draw this type of line (Shadowed line) for my bottom border any help???
Create a 9 patch of the same image, mark the expandable area as everything above this border, and set this 9 patch as the background of the view to which you want to have this border.
You could also, create a LinearLayout with required height (2-3 dp?) and use this as the background image. Put this layout below the view for which you want this border.

Android - How to create a view with rounded corners and a tiled image background?

I'm trying to create a view in Android that has rounded corners and also uses a tiled image background (and which appears on top of another view with a tiled background).
I can create a shape drawable for the corners and a bitmap drawable for the tiled image, but I can't see how I can apply them both the same view.
Some things I've attempted:
Nesting the view with the tiled background inside a view with rounded corners - doesn't work, the tiled background just appears on top with square corners
Paint over the corners of the view with rounded corners - this doesn't work because of the tiled background of the view below (otherwise would work fine)
I believe your custom View should define its drawing region with a Path. You could then draw the Path with a paint and shader doing what you want (fill and tile).
http://developer.android.com/reference/android/graphics/Path.html
You can check video which contains a way to do it without using clipPath which is not supported with hardware acceleration.

Categories

Resources