问题描述
我想要的形状与左上方的圆角和左下方圆角:
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="0dp"/>
</shape>
但外形上面没有给我我想要的。它给了我一个矩形没有任何圆角。
But the shape above didn't give me what I want. It gives me a rectangle without any rounded corners.
谁能帮助?
感谢。
推荐答案
尽管这个问题已经被回答(这是一个错误,导致bottomLeftRadius和bottomRightRadius颠倒),该错误已被固定在机器人3.1(API级别12 - 测试在模拟器上)。
While this question has been answered already (it's a bug that causes bottomLeftRadius and bottomRightRadius to be reversed), the bug has been fixed in android 3.1 (api level 12 - tested on the emulator).
因此,为了确保您可绘制看起来是正确的在所有平台上,你应该把纠正的可绘制的版本(也就是在这里下左/右半径在XML实际上是正确的)在res /绘制-V12的文件夹应用程序。通过这种方式使用的是Android版本> = 12将使用正确的绘制文件中的所有设备,而使用旧版本的Android将使用位于水库的变通办法可绘制设备/可绘制文件夹。
So to make sure your drawables look correct on all platforms, you should put "corrected" versions of the drawables (i.e. where bottom left/right radii are actually correct in the xml) in the res/drawable-v12 folder of your app. This way all devices using an android version >= 12 will use the correct drawable files, while devices using older versions of android will use the "workaround" drawables that are located in the res/drawables folder.
这篇关于如何使左顶圆圆角和左下方圆角的形状?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!