android-shape

Android custom vector scaling

不打扰是莪最后的温柔 提交于 2021-01-29 19:12:24
问题 I am attempting to create a custom shape to use as the background for my menu drawer. The issue i'm experiencing is that i can't get the shape i want. At the moment i am creating the shape as an svg in Adobe Illustrator and then converting that into an XML drawable but it isn't having the desired effect. How can i get the vector drawable to scale depending on its parent ( match_parent ) and content ( wrap_content )? menu_shape.xml An issue i've picked up on this is that this shape isn't

What does top, left, right and bottom mean in Android Rect object

↘锁芯ラ 提交于 2020-04-07 10:49:46
问题 I have an Android project where I should make Apples fall. The apples are painted in a Rect. So I created a function that change the Rect position and repaint. Here's my function : private void updateApplesPosition() { for(Rect rect:fallingDownFruitsList) rect.set(rect.left, rect.top +10, rect.right, rect.bottom +10); } I have a problem : the Apples don't fall but go from right to left. To make the apples fall I changed the code by this : private void updateApplesPosition() { for(Rect rect

How to make a shape with left-top round rounded corner and left-bottom rounded corner?

眉间皱痕 提交于 2020-01-27 08:56:48
问题 I want to make a shape with with left-top rounded corner and left-bottom rounded corner: <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#555555"/> <stroke android:width="3dp" android:color="#555555" /> <padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" /> <corners android:bottomRightRadius="0dp" android:bottomLeftRadius="2dp" android:topLeftRadius="2dp" android:topRightRadius=

How to make a shape with left-top round rounded corner and left-bottom rounded corner?

此生再无相见时 提交于 2020-01-27 08:55:31
问题 I want to make a shape with with left-top rounded corner and left-bottom rounded corner: <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#555555"/> <stroke android:width="3dp" android:color="#555555" /> <padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" /> <corners android:bottomRightRadius="0dp" android:bottomLeftRadius="2dp" android:topLeftRadius="2dp" android:topRightRadius=

how to build a trapezoid shape in android?

旧城冷巷雨未停 提交于 2020-01-21 04:17:40
问题 how can I create a trapezoid shape like below image ? I don't want to use an image or 9.png . 回答1: Try this: <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="292dp" android:height="172dp" android:viewportWidth="292" android:viewportHeight="172"> <path android:strokeWidth="1.5" android:strokeMiterLimit="10" android:pathData="M 27.046 96.615 L 16.416 150.396 L 271.534 150.396 L 186.495 22.836 L 37.676 22.836 L 27.046 86.615

how to build a trapezoid shape in android?

旧城冷巷雨未停 提交于 2020-01-21 04:15:19
问题 how can I create a trapezoid shape like below image ? I don't want to use an image or 9.png . 回答1: Try this: <?xml version="1.0" encoding="utf-8"?> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="292dp" android:height="172dp" android:viewportWidth="292" android:viewportHeight="172"> <path android:strokeWidth="1.5" android:strokeMiterLimit="10" android:pathData="M 27.046 96.615 L 16.416 150.396 L 271.534 150.396 L 186.495 22.836 L 37.676 22.836 L 27.046 86.615

Crop an Image/drawable to a triangle

泪湿孤枕 提交于 2020-01-17 07:35:07
问题 I'm trying to crop an image to triangle in my Android App so that I only get the triangle portion of the image. How can this be done? I've successfully done the cropping for Square and Circle shapes but I'm unable to do the same for the triangle. Could someone help me with this. Thanks. David 回答1: You can Use a "Mask" Image.. this image should be a triangle in your case (or any other shape you need) like this : ImageView mImageView= (ImageView)findViewById(R.id.imageview_id); Bitmap original

How do i draw these kinds custom shape?

余生长醉 提交于 2020-01-16 09:07:10
问题 I have the following design and need to make without using png file if possible. I have done this with the help of png file but i am thinking if there is any other way which is performance centric. I have done this design with the help of png file https://pasteboard.co/Is3RtJY.png How do i draw this myself or use some tool to get this done? 回答1: Use the following code to create this custom shape bg_top_corners_round.xml and save it in your drawable: <shape xmlns:android="http://schemas