How to draw rounded corner shape mentioned below in android drawable
I have tried with that code but seems not correct please help
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:fromDegrees="45"
android:pivotX="35%"
android:pivotY="30%">
<shape>
<size android:height="5dp" android:width="5dp"/>
<corners android:radius="0.5dp" />
<solid android:color="@color/white" />
</shape>
</rotate>
</item>
android
add a comment |
I have tried with that code but seems not correct please help
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:fromDegrees="45"
android:pivotX="35%"
android:pivotY="30%">
<shape>
<size android:height="5dp" android:width="5dp"/>
<corners android:radius="0.5dp" />
<solid android:color="@color/white" />
</shape>
</rotate>
</item>
android
useShapeDrawable
with a customShape
object passed toShapeDrawable
constructor
– pskink
Nov 15 '18 at 7:45
I think the best way is to use vector drawable from svg file, ( probably created / edited using Inkscape / adobe illustrator ) and importing as drawable.
– Monster Brain
Nov 15 '18 at 9:36
add a comment |
I have tried with that code but seems not correct please help
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:fromDegrees="45"
android:pivotX="35%"
android:pivotY="30%">
<shape>
<size android:height="5dp" android:width="5dp"/>
<corners android:radius="0.5dp" />
<solid android:color="@color/white" />
</shape>
</rotate>
</item>
android
I have tried with that code but seems not correct please help
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<rotate
android:fromDegrees="45"
android:pivotX="35%"
android:pivotY="30%">
<shape>
<size android:height="5dp" android:width="5dp"/>
<corners android:radius="0.5dp" />
<solid android:color="@color/white" />
</shape>
</rotate>
</item>
android
android
asked Nov 15 '18 at 7:34
devdev
91213
91213
useShapeDrawable
with a customShape
object passed toShapeDrawable
constructor
– pskink
Nov 15 '18 at 7:45
I think the best way is to use vector drawable from svg file, ( probably created / edited using Inkscape / adobe illustrator ) and importing as drawable.
– Monster Brain
Nov 15 '18 at 9:36
add a comment |
useShapeDrawable
with a customShape
object passed toShapeDrawable
constructor
– pskink
Nov 15 '18 at 7:45
I think the best way is to use vector drawable from svg file, ( probably created / edited using Inkscape / adobe illustrator ) and importing as drawable.
– Monster Brain
Nov 15 '18 at 9:36
use
ShapeDrawable
with a custom Shape
object passed to ShapeDrawable
constructor– pskink
Nov 15 '18 at 7:45
use
ShapeDrawable
with a custom Shape
object passed to ShapeDrawable
constructor– pskink
Nov 15 '18 at 7:45
I think the best way is to use vector drawable from svg file, ( probably created / edited using Inkscape / adobe illustrator ) and importing as drawable.
– Monster Brain
Nov 15 '18 at 9:36
I think the best way is to use vector drawable from svg file, ( probably created / edited using Inkscape / adobe illustrator ) and importing as drawable.
– Monster Brain
Nov 15 '18 at 9:36
add a comment |
3 Answers
3
active
oldest
votes
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp"
android:bottomLeftRadius="75dp"
android:bottomRightRadius="9dp"
/>
<gradient
android:angle="45"
android:centerX="35%"
android:centerColor="#47A891"
android:startColor="#E8E8E8"
android:endColor="#000000"
android:type="linear"
/>
<padding
android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp"
/>
<size
android:width="100dp"
android:height="100dp"
/>
<stroke
android:width="3dp"
android:color="#878787"
/>
</shape>
add a comment |
Probably it would be easier using a vector drawable:
<vector android:height="24dp" android:viewportHeight="101.01621"
android:viewportWidth="114.45102" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#00000000"
android:pathData="m0.421,7.319c-0.848,-4.225 2.893,-6.292 4.701,-6.534l93.265,-0.552c9.395,-0.736 15.906,2.42 15.875,15.875l-0.032,78.398c1.262,7.668 -11.009,7.894 -15.926,3.48 -17.528,-8.582 -70.939,-31.855 -92.048,-40.468 -1.899,-0.775 -3.147,-1.13 -4.14,-1.522 -2.225,-0.879 -2.097,-3.281 -1.851,-5.335z"
android:strokeAlpha="1" android:strokeColor="#000000"
android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
</vector>
If you need to make some adjustments, you shold download Inkscape (https://inkscape.org) or another svg design software and my source file (if your want) https://drive.google.com/open?id=1vY8tYcA00KAQeoulMlPmwvRWrs7EY672. Draw your shape and than export it again in svg. Once you have your file in svg format you can use vector asset tool from Android Studio. The tool generates automatically your vector xml and that you can use the vector drawable as a common drawable, for example as a source of an ImageView. Hope it helps!
add a comment |
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- view background color -->
<solid
android:color="#142737" >
</solid>
<!-- Here is the corner radius -->
<corners
android:radius="10dp" >
</corners>
place this xml file in drawable folder and set it as the background of the button like:
android:background="@drawable/oval_background"
Did you try my solution?
– Nicola Gallazzi
Nov 15 '18 at 16:57
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314437%2fhow-to-draw-rounded-corner-shape-mentioned-below-in-android-drawable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp"
android:bottomLeftRadius="75dp"
android:bottomRightRadius="9dp"
/>
<gradient
android:angle="45"
android:centerX="35%"
android:centerColor="#47A891"
android:startColor="#E8E8E8"
android:endColor="#000000"
android:type="linear"
/>
<padding
android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp"
/>
<size
android:width="100dp"
android:height="100dp"
/>
<stroke
android:width="3dp"
android:color="#878787"
/>
</shape>
add a comment |
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp"
android:bottomLeftRadius="75dp"
android:bottomRightRadius="9dp"
/>
<gradient
android:angle="45"
android:centerX="35%"
android:centerColor="#47A891"
android:startColor="#E8E8E8"
android:endColor="#000000"
android:type="linear"
/>
<padding
android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp"
/>
<size
android:width="100dp"
android:height="100dp"
/>
<stroke
android:width="3dp"
android:color="#878787"
/>
</shape>
add a comment |
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp"
android:bottomLeftRadius="75dp"
android:bottomRightRadius="9dp"
/>
<gradient
android:angle="45"
android:centerX="35%"
android:centerColor="#47A891"
android:startColor="#E8E8E8"
android:endColor="#000000"
android:type="linear"
/>
<padding
android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp"
/>
<size
android:width="100dp"
android:height="100dp"
/>
<stroke
android:width="3dp"
android:color="#878787"
/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners
android:topLeftRadius="12dp"
android:topRightRadius="12dp"
android:bottomLeftRadius="75dp"
android:bottomRightRadius="9dp"
/>
<gradient
android:angle="45"
android:centerX="35%"
android:centerColor="#47A891"
android:startColor="#E8E8E8"
android:endColor="#000000"
android:type="linear"
/>
<padding
android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp"
/>
<size
android:width="100dp"
android:height="100dp"
/>
<stroke
android:width="3dp"
android:color="#878787"
/>
</shape>
answered Nov 15 '18 at 9:50
veerendranveerendran
364
364
add a comment |
add a comment |
Probably it would be easier using a vector drawable:
<vector android:height="24dp" android:viewportHeight="101.01621"
android:viewportWidth="114.45102" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#00000000"
android:pathData="m0.421,7.319c-0.848,-4.225 2.893,-6.292 4.701,-6.534l93.265,-0.552c9.395,-0.736 15.906,2.42 15.875,15.875l-0.032,78.398c1.262,7.668 -11.009,7.894 -15.926,3.48 -17.528,-8.582 -70.939,-31.855 -92.048,-40.468 -1.899,-0.775 -3.147,-1.13 -4.14,-1.522 -2.225,-0.879 -2.097,-3.281 -1.851,-5.335z"
android:strokeAlpha="1" android:strokeColor="#000000"
android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
</vector>
If you need to make some adjustments, you shold download Inkscape (https://inkscape.org) or another svg design software and my source file (if your want) https://drive.google.com/open?id=1vY8tYcA00KAQeoulMlPmwvRWrs7EY672. Draw your shape and than export it again in svg. Once you have your file in svg format you can use vector asset tool from Android Studio. The tool generates automatically your vector xml and that you can use the vector drawable as a common drawable, for example as a source of an ImageView. Hope it helps!
add a comment |
Probably it would be easier using a vector drawable:
<vector android:height="24dp" android:viewportHeight="101.01621"
android:viewportWidth="114.45102" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#00000000"
android:pathData="m0.421,7.319c-0.848,-4.225 2.893,-6.292 4.701,-6.534l93.265,-0.552c9.395,-0.736 15.906,2.42 15.875,15.875l-0.032,78.398c1.262,7.668 -11.009,7.894 -15.926,3.48 -17.528,-8.582 -70.939,-31.855 -92.048,-40.468 -1.899,-0.775 -3.147,-1.13 -4.14,-1.522 -2.225,-0.879 -2.097,-3.281 -1.851,-5.335z"
android:strokeAlpha="1" android:strokeColor="#000000"
android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
</vector>
If you need to make some adjustments, you shold download Inkscape (https://inkscape.org) or another svg design software and my source file (if your want) https://drive.google.com/open?id=1vY8tYcA00KAQeoulMlPmwvRWrs7EY672. Draw your shape and than export it again in svg. Once you have your file in svg format you can use vector asset tool from Android Studio. The tool generates automatically your vector xml and that you can use the vector drawable as a common drawable, for example as a source of an ImageView. Hope it helps!
add a comment |
Probably it would be easier using a vector drawable:
<vector android:height="24dp" android:viewportHeight="101.01621"
android:viewportWidth="114.45102" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#00000000"
android:pathData="m0.421,7.319c-0.848,-4.225 2.893,-6.292 4.701,-6.534l93.265,-0.552c9.395,-0.736 15.906,2.42 15.875,15.875l-0.032,78.398c1.262,7.668 -11.009,7.894 -15.926,3.48 -17.528,-8.582 -70.939,-31.855 -92.048,-40.468 -1.899,-0.775 -3.147,-1.13 -4.14,-1.522 -2.225,-0.879 -2.097,-3.281 -1.851,-5.335z"
android:strokeAlpha="1" android:strokeColor="#000000"
android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
</vector>
If you need to make some adjustments, you shold download Inkscape (https://inkscape.org) or another svg design software and my source file (if your want) https://drive.google.com/open?id=1vY8tYcA00KAQeoulMlPmwvRWrs7EY672. Draw your shape and than export it again in svg. Once you have your file in svg format you can use vector asset tool from Android Studio. The tool generates automatically your vector xml and that you can use the vector drawable as a common drawable, for example as a source of an ImageView. Hope it helps!
Probably it would be easier using a vector drawable:
<vector android:height="24dp" android:viewportHeight="101.01621"
android:viewportWidth="114.45102" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#00000000"
android:pathData="m0.421,7.319c-0.848,-4.225 2.893,-6.292 4.701,-6.534l93.265,-0.552c9.395,-0.736 15.906,2.42 15.875,15.875l-0.032,78.398c1.262,7.668 -11.009,7.894 -15.926,3.48 -17.528,-8.582 -70.939,-31.855 -92.048,-40.468 -1.899,-0.775 -3.147,-1.13 -4.14,-1.522 -2.225,-0.879 -2.097,-3.281 -1.851,-5.335z"
android:strokeAlpha="1" android:strokeColor="#000000"
android:strokeLineCap="butt" android:strokeLineJoin="miter" android:strokeWidth="0.26458332"/>
</vector>
If you need to make some adjustments, you shold download Inkscape (https://inkscape.org) or another svg design software and my source file (if your want) https://drive.google.com/open?id=1vY8tYcA00KAQeoulMlPmwvRWrs7EY672. Draw your shape and than export it again in svg. Once you have your file in svg format you can use vector asset tool from Android Studio. The tool generates automatically your vector xml and that you can use the vector drawable as a common drawable, for example as a source of an ImageView. Hope it helps!
edited Nov 15 '18 at 10:13
answered Nov 15 '18 at 10:06
Nicola GallazziNicola Gallazzi
1,307718
1,307718
add a comment |
add a comment |
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- view background color -->
<solid
android:color="#142737" >
</solid>
<!-- Here is the corner radius -->
<corners
android:radius="10dp" >
</corners>
place this xml file in drawable folder and set it as the background of the button like:
android:background="@drawable/oval_background"
Did you try my solution?
– Nicola Gallazzi
Nov 15 '18 at 16:57
add a comment |
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- view background color -->
<solid
android:color="#142737" >
</solid>
<!-- Here is the corner radius -->
<corners
android:radius="10dp" >
</corners>
place this xml file in drawable folder and set it as the background of the button like:
android:background="@drawable/oval_background"
Did you try my solution?
– Nicola Gallazzi
Nov 15 '18 at 16:57
add a comment |
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- view background color -->
<solid
android:color="#142737" >
</solid>
<!-- Here is the corner radius -->
<corners
android:radius="10dp" >
</corners>
place this xml file in drawable folder and set it as the background of the button like:
android:background="@drawable/oval_background"
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- view background color -->
<solid
android:color="#142737" >
</solid>
<!-- Here is the corner radius -->
<corners
android:radius="10dp" >
</corners>
place this xml file in drawable folder and set it as the background of the button like:
android:background="@drawable/oval_background"
edited Nov 16 '18 at 6:45
answered Nov 15 '18 at 10:15
chetnachetna
795
795
Did you try my solution?
– Nicola Gallazzi
Nov 15 '18 at 16:57
add a comment |
Did you try my solution?
– Nicola Gallazzi
Nov 15 '18 at 16:57
Did you try my solution?
– Nicola Gallazzi
Nov 15 '18 at 16:57
Did you try my solution?
– Nicola Gallazzi
Nov 15 '18 at 16:57
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314437%2fhow-to-draw-rounded-corner-shape-mentioned-below-in-android-drawable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
use
ShapeDrawable
with a customShape
object passed toShapeDrawable
constructor– pskink
Nov 15 '18 at 7:45
I think the best way is to use vector drawable from svg file, ( probably created / edited using Inkscape / adobe illustrator ) and importing as drawable.
– Monster Brain
Nov 15 '18 at 9:36