android-shape

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

Android - shape on horizontal line

假装没事ソ 提交于 2020-01-13 10:56:26
问题 I have a xml , that in this xml I adding Horizontal Line between TextViews . I add a Shape to separator but I can't see changes. main_activity.xml : <TextView android:id="@+id/title" android:layout_width="match_parent" android:layout_height="20dp" android:text="HELLO" android:textColor="@android:color/black" /> <View android:id="@+id/vVerticalLine" android:background="@drawable/horizontal_shape" android:layout_width="match_parent" android:layout_marginLeft="50dp" android:layout_marginRight=

Add only top and bottom border on LinearLayout

╄→尐↘猪︶ㄣ 提交于 2019-12-31 18:56:12
问题 I would like to add only a bottom and a top border on my Linearlayout . I have tried to do this : <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item android:bottom="1dp" android:top="1dp"> <shape android:shape="rectangle"> <solid android:color="#FFFFFF" /> <stroke android:width="1dp" android:color="#000" /> </shape> </item> </layer-list> But it add a border around the shape.. Could you help me please ? 回答1: Make this two file

Nested shapes in Android

孤街浪徒 提交于 2019-12-30 07:31:36
问题 I am trying to draw a shape that has three rectangular shapes: solid color gradient white line How do I do that? When I try this, it does not work. The layout has the parent color. <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:height="60px" > <shape android:shape="rectangle" android:height="30px" > <solid android:color="#ff297baf" /> </shape> <shape android:shape="rectangle" android:height="30px" > <gradient android:type="linear" android

Button's background drawable (shape) won't show up unless app API is 20+ (Android L)

落花浮王杯 提交于 2019-12-23 13:28:08
问题 In my Android app, I'm trying to set a simple ring shape as background drawable for my Buttons. But as much as I try, the XML preview ignores the background drawable unless the API level is set to 20 (Android L) What's going on? I'm sure people used to set shapes for buttons before L. Code for my XML shape for button_ring.xml located in /drawables folder <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="ring" > <solid

Android - Background color with different color and angles

百般思念 提交于 2019-12-23 10:39:04
问题 I'm trying to figure out how to create this background in xml, couldn't find anything that helped me. Ignore the circle image of the kid and the text of course, I am talking about the background itself, is there a way to create something like that in xml? Thanks in advance for any help. cheers! 回答1: I'm guessing you moved on, but you can do this using Vector Drawables. The following is not accurate (the line is not completely straight), but should give you a good start: New XML file: <?xml

Android - Background color with different color and angles

这一生的挚爱 提交于 2019-12-23 10:38:13
问题 I'm trying to figure out how to create this background in xml, couldn't find anything that helped me. Ignore the circle image of the kid and the text of course, I am talking about the background itself, is there a way to create something like that in xml? Thanks in advance for any help. cheers! 回答1: I'm guessing you moved on, but you can do this using Vector Drawables. The following is not accurate (the line is not completely straight), but should give you a good start: New XML file: <?xml

How to make shadow in layer-list?

余生颓废 提交于 2019-12-22 22:23:10
问题 The problem is as follows: I need to make in app widget some actionbar like this: For this I use layer-list with shape. <?xml version="1.0" encoding="utf-8"?> <!-- Bottom 2dp Shadow --> <item> <shape android:shape="rectangle"> <solid android:color="#027668"/> <corners android:radius="12dp"/> </shape> </item> <!-- White Top color --> <item android:bottom="4dp"> <shape android:shape="rectangle"> <solid android:color="#20a18b" /> <corners android:radius="7dp" /> </shape> </item> And I get some

Custom shaped Linearlayout with curved side in android

允我心安 提交于 2019-12-20 11:59:09
问题 I am trying to make a custom shaped linearlayout like below I am trying to make only one side curved. Tried with corner radius but it doesn't give the same look as above. Already tried this background shape as below :- <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="#3F51B5" /> <padding android:bottom="7dp" android:left="7dp" android:right="7dp" android:top="7dp" /> <corners android

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