Anyone got a clue how to handle following issue:
I have a Layout with background drawable like grey border, then I add padding of the border width to `Layout.
Child Layout has background drawable representing a selector, when pressed its darker gray (see image) and when not pressed its little bit lighter.
How to get rid of that sharp edge in the picture, I can't add margin to child Layout, because the pressed state must fill totally the child Layout.
It seems that the only solution here is to add the margin and suck it, or adjust the background drawables to have rounded corners as well.
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.
How to make background opacity of the View (for ex. EditField )with transparent, infliction, subtraction "Screen" like it is in Photoshop?
I know if I set background to "#android:color/transparent" for EditField then white background will be visible, but not main backgrounf of the layout
I need to implement this one:
You can't do it simply.. not by any code.. the only way to do that is to get a drawable .png image(you need photoshop to create it) that has this shape(semi tranaparent on the frame ans fully transparent inthe center with rounded corners).. make it with small width .. and use 9patch tool for stretching (so you can get flexible width)...
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" />
I'm changing Background color of a button programmatically as below
Button button =(Button)findViewById(R.id.one);
button.setBackgroundColor(0xFFFF0000);
But after this the size of button getting increased.. Im using relative layout in UI.
Default button background drawable has some kind of margins. These margins are just transparent pixels on the sides of the image. When you set background color for a button these margins disappear because the whole rectangle of the button is filled with the color.