[英]Android - Curve Corner in specific angle
Is there any way to curve corner radius of a rectangle in specific degree, Like this Image https://imgur.com/a/1rkARTh有没有办法以特定程度弯曲矩形的角半径,像这个图像https://imgur.com/a/1rkARTh
I think there is not proper way to create rectangles with specific degree.我认为没有合适的方法来创建具有特定度数的矩形。 But you can draw a shape like this from photoshop and use that as your backgruond.但是您可以从 Photoshop 中绘制这样的形状并将其用作背景。
Photoshop: Photoshop:
Android Studio: Android 工作室:
Edit: I designed your background.编辑:我设计了你的背景。 Create a xml file in drawable folder and past this code在可绘制文件夹中创建一个 xml 文件并通过此代码
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="496dp"
android:height="701.6dp"
android:viewportWidth="2480"
android:viewportHeight="3508">
<path
android:fillColor="#ffffff"
android:pathData="M665,491H1868c163.95,0 230,93.38 230,276V1974.34c0,181.63 -143.4,268.71 -308.25,193.55l-1165.7,-531.42C551.45,1603.37 498,1488 498,1379V691C498,581.54 592.7,491 665,491Z"
android:strokeLineJoin="round"
android:strokeWidth="0"
android:fillType="evenOdd"
android:strokeColor="#fff200"
android:strokeLineCap="round"/>
<path
android:fillColor="#ffffff"
android:pathData="M714,1890l1241,535c119.88,57.69 140,98.78 140,178v123c0,123.09 -125.48,146 -158,146H791c-181.54,0 -293,-27.95 -293,-243V2056C498,1841.29 648.54,1851.85 714,1890Z"
android:strokeLineJoin="round"
android:strokeWidth="0"
android:fillType="evenOdd"
android:strokeColor="#fff200"
android:strokeLineCap="round"/>
</vector>
You can create a Vector drawable, but you need to understand SVG xml language to do this, It's better to use photoshop PNG file for the background image (as every view in android is a rectangle.您可以创建一个矢量可绘制对象,但您需要了解 SVG xml 语言来执行此操作,最好使用 Photoshop PNG 文件作为背景图像(因为 ZC31B32364CE19CA8FCD150AZ17 中的每个视图都是一个矩形。
Sample vector drawable xml.示例矢量可绘制 xml。
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8zM12.5,7H11v6l5.25,3.15 0.75,-1.23 -4.5,-2.67z"/>
</vector>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.