android-shapedrawable

ImageView with only one rounded corner

拜拜、爱过 提交于 2020-01-14 06:21:08
问题 I'm trying to make one rounded corner of ImageView like in the picture below but with bottom right corner. Tried using background shape but it's not working at all. All images loaded by Glide. Should i use something like ViewOutlineProvider ? Is there are an efficient way to do this? Thanks! <shape xmlns:android="http://schemas.android.com/apk/res/android" > <corners android:radius="2dp" android:bottomRightRadius="20dp" android:bottomLeftRadius="0dp" android:topLeftRadius="0dp" android

How to build trapezoid shape in xml android?

穿精又带淫゛_ 提交于 2019-12-30 06:31:09
问题 I want to build this shape with bottom line and text inside it i'm confused little bit how to achieve this i tired some code but don't get required thing. so far i have tried this code shape.xml <?xml version="1.0" encoding="UTF-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <!-- Colored rectangle--> <item> <shape android:shape="rectangle"> <size android:width="100dp" android:height="40dp" /> <solid android:color="#13a89e" /> </shape> </item> <!-- This rectangle

prevent partial overlapping of shape drawable stroke

邮差的信 提交于 2019-12-21 04:09:18
问题 Is there any way to prevent partial overlapping of the stroke on the shape drawable . I prefer to overlap the stroke completely on the borders of the shape. Here is my xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <padding android:bottom="0dp" android:top="0dp" android:left="0dp" android:right="0dp" /> <solid android:color="@color/green" /> <stroke android:color="@color/red_50" android:width="20dp"

Android set radius programatically to ShapeDrawable

﹥>﹥吖頭↗ 提交于 2019-12-13 11:13:22
问题 Can I set a radius programmatically to a ShapeDrawable? 回答1: You can do it like this: public static void customView(View v, int backgroundColor, int borderColor) { GradientDrawable shape = new GradientDrawable(); shape.setShape(GradientDrawable.RECTANGLE); shape.setCornerRadii(new float[] { 8, 8, 8, 8, 0, 0, 0, 0 }); shape.setColor(backgroundColor); shape.setStroke(3, borderColor); v.setBackgroundDrawable(shape); } You can use this function throughout your app and can put border and

Shape drawable not working?

五迷三道 提交于 2019-12-13 10:23:02
问题 <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" android:thickness="3dp" android:innerRadius="34dp"> <solid android:color="@color/colorAccent"/> </shape> I want to create ring but nothing appears. 回答1: use this code, <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:top="4dp" android:right="4dp" android:bottom="4dp" android:left="4dp"> <shape

Unable to understand layer-list

廉价感情. 提交于 2019-12-11 11:14:02
问题 <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:top="4dp" android:right="4dp" android:bottom="4dp" android:left="4dp"> <shape android:shape="oval"> <solid android:color="#ff0000" /> </shape> </item> <item> <shape android:shape="oval"> <stroke android:width="2dp" android:color="#ff0000"/> </shape> </item> </layer-list> taken from here: https://stackoverflow.com/a/36003935/6007737 How is it giving me a ring shape? How

Cut part of XML shape

拟墨画扇 提交于 2019-12-11 07:58:21
问题 I have a rectangle shape view in XML: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/lightblue"/> </shape> What I want is cut it in half, so result will looks like: Is it possible? And if yes, how do I achieve it? Note: 1) Adding rotated white rectangle isn't solution. I need to keep cutted area of the blue shape transparent (there are more View layers under it). 2) Bottom left

Why doesn't this argument of the LinearGradient constructor seem to work?

天大地大妈咪最大 提交于 2019-12-11 00:39:44
问题 I want to set a custom drawable with a linear gradient as the background drawable of the bar in my SeekBar . I am creating the LinearGradient in the second statement in the following snippet, and doing it like so: // Creating the drawable: ShapeDrawable shapeDrawable = new ShapeDrawable(new RectShape()); Shader linearGradientShader = new LinearGradient(0, 0, 300, 20, new int[] { Color.RED, Color.BLUE }, new float[] { 0, 1 }, Shader.TileMode.CLAMP); shapeDrawable.getPaint().setShader

Blurred 1dip shape lines (borders) on Android

佐手、 提交于 2019-12-08 02:38:18
问题 Here is the screenshot from my app: It's taken from Samsung Galaxy Note 10.1 ( mdpi 149 ppi ). My client thinks that the border line around bottom buttons and rounded rectangle above are blurred. I'm using shape as a background which looks like this: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <corners android:radius="8dp" /> <stroke android:width="1dp" android:color="@color/dark_gray" /> <solid android:color="@color/sepia_bright" /> </shape>

Blurred 1dip shape lines (borders) on Android

青春壹個敷衍的年華 提交于 2019-12-06 05:57:12
Here is the screenshot from my app: It's taken from Samsung Galaxy Note 10.1 ( mdpi 149 ppi ). My client thinks that the border line around bottom buttons and rounded rectangle above are blurred. I'm using shape as a background which looks like this: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <corners android:radius="8dp" /> <stroke android:width="1dp" android:color="@color/dark_gray" /> <solid android:color="@color/sepia_bright" /> </shape> When I use simple view as a line with 1dp height like this: <View android:background="@color/bright