shape

Android bottom zig-zag shape

萝らか妹 提交于 2019-11-27 15:25:27
问题 I need to achieve below attached image programatically, is there any way? I know how to draw rectangle in layer-list but for the particular zig-zag texture in bottom I don't have any idea Please help me to achieve this shape Thanks in advance 回答1: to draw a dashed line you can use a shape <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"> <stroke android:color="#FF00" android:dashWidth="5dp" android:dashGap="5dp" /> </shape> if you want to combine more

Drawable shape not showing when used in combination with android:drawableBottom attribute.

半城伤御伤魂 提交于 2019-11-27 14:52:18
问题 XML file saved at res/drawable/gradient_box.xml: <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#FFFF0000" android:endColor="#80FF00FF" android:angle="45"/> <padding android:left="7dp" android:top="7dp" android:right="7dp" android:bottom="7dp" /> <corners android:radius="8dp" /> </shape> (The above shape definition is is taken from then Android developer guide. There's no errors

Android - how to define ShapeDrawables programmatically?

人盡茶涼 提交于 2019-11-27 12:05:26
What I'm trying to achieve is to use a Drawable with a couple of layers inside it, but control some values at runtime such as the startColor for the gradient. Here's what I have in my_layered_shape.xml: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle"> <stroke android:width="1dp" android:color="#FF000000" /> <solid android:color="#FFFFFFFF" /> </shape> </item> <item android:top="1dp" android:bottom="1dp"> <shape android:shape="rectangle"> <stroke android:width="1dp" android:color="#FF000000"

Half circle shape not work

会有一股神秘感。 提交于 2019-11-27 11:41:41
I try to create half circle background, in development IDE preview it works, but when I launch in emulator it doesn't work. Here is my shape code : <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:height="50dp"> <shape> <solid android:color="@color/colorAccentDark" /> </shape> </item> <item android:top="-500dp" android:bottom="0dp" android:left="-100dp" android:right="-100dp"> <shape> <corners android:radius="500dp" /> <solid android:color="@color/colorAccentDark" /> </shape> </item> </layer-list> And here is my layout

SVG to Android Shape [closed]

和自甴很熟 提交于 2019-11-27 10:25:36
I'm wondering how vector drawing in Android with the Shape class may resemble another vector drawing standard. Since Shape is a Drawable , and Drawables are usually defined as XML, it sounds a lot like the vector drawing commands in SVG. My question is this: Has anybody created an XSLT transformation, or other mechanism, for converting an SVG drawing description into Android Shapes? dgmltn Another non-GPL'd library (this one is Apache License 2.0), the one used in Google's Androidify app: svg-android https://github.com/pents90/svg-android Well, not exactly. But I do have ported libsvg to

Changing color in a shape inside a layer-list programmatically

别说谁变了你拦得住时间么 提交于 2019-11-27 09:24:52
I am trying to change programmatically the color of the selectable_kachel_shape . Here is the xml file: kachel_ticked_style.xml <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:id="@+id/selectable_kachel_shape" android:shape="rectangle" > <stroke android:width="5dp" android:color="@color/headrbar_color" /> </shape> </item> <item> <rotate android:fromDegrees="45" android:pivotX="120%" android:pivotY="100%" android:toDegrees="45" > <shape android:shape="line" > <stroke android:width="40dp" android:color="@color/headrbar_color" /> </shape> </rotate> <

Shape drawable as background, a line at the bottom

為{幸葍}努か 提交于 2019-11-27 09:24:20
问题 I am using a drawable as a background of a TextView just to have a divider line below the text. A achivied it with this drawable-xml: <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle"> <solid android:color="#FFDDDDDD" /> <gradient android:angle="0" android:startColor="#FFAAAAAA" android:endColor="#FFEEEEEE" /> </shape> </item> <item android:bottom="2dp"> <shape android:shape="rectangle">

How do I create a 'Parallelogram' shape in css with a straight side? [duplicate]

◇◆丶佛笑我妖孽 提交于 2019-11-27 08:02:47
问题 This question already has an answer here: How to bevel the corner of a block div? 4 answers I am trying to create a Parallelogram with a straight right side in css but so far I am struggling to achieve this. I am using css ... -webkit-transform: skew(-18deg); -moz-transform: skew(-18deg); -o-transform: skew(-18deg); ...to 'skew' the rectangle to create the Parallelogram. I am wondering if the right side can be made straight? Would it require :before and :after in the css? Any help of this

How to set button by a contour polygon? Android

拜拜、爱过 提交于 2019-11-27 07:00:53
问题 There are two adjacent graphic buttons. If I use the method of calculation of the coordinates touch TouchEvent , I have to create a large array of coordinates. Maybe there is another method? 回答1: Probably not the best solution but you could overlap two buttons each representing a part of the image(the black or white) and make the rest of the Button 's image transparent(the images will have the same dimensions for both buttons). You'll also need to extend the Button class to override how the

Creating an Isoceles Trapezoid shape

僤鯓⒐⒋嵵緔 提交于 2019-11-27 05:39:26
I'm wondering if I could produce something similar to this with CSS: And I'm also wondering, is this the right place for such a question? I have not tried anything codewise, I've done the brown images with photoshop. Thanks for any help ! This shape (an Isoceles Trapezoid ) can be easily made using CSS3 by rotating a div with a bit of perspective . Explanation The shape is achieved by rotating an absolutely positioned pseudo-element ( .container:after ) along the x-axis with a perspective. We are not rotating the actual container div because it would cause the link (and any other) text inside