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.
Related
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.
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 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" />
Is it possible in Android to programmatically draw a line using a path, such that the middle section is a solid color but both ends fade from that color to transparent? The path will be a series of calculated coordinates.
Yes, use a generic View widget with a drawable that contains a gradient as its background.
Make sure it extends to match_parent in the direction you want it to cut your layout and it's 1px tall or wide in the other dimension.
The gradient should be a simple linear gradient transparent to solid to transparent.
Here is a very nice tutorial.
Update:
The above link is dead, try this one instead.
I got a widget and when I use a color as a background, all the components inside have a 0 padding when I use android:layout_alignParentTop="true" (same for other sides).
But when I use a 9 patch image as the background of the parent, it seems to have a padding that is equal to the non stretchable size of the 9 patch image when I align them on their parent.
Is this normal ?
There are two main parts to a nine-patch: the stretchable areas and the content-defined areas. The top and left pixel border define the stretchable area, as I'm sure you're aware. The bottom and right, however, define the CONTENT area. If you want the padding to go away, you need to make the bottom and right bar extend all the way to the edge of the artwork (not all the way to the corner pixels, though!). Basically, the right and bottom pixel border define your padding.