Android:形状“角”问题。这是一个错误吗?
我当时正在玩角球,我对这种行为很感兴趣。 XML布局:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list_header_title"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:padding="10dip"
android:gravity="center_vertical"
android:background="@layout/my_outline"
android:text="Example"
android:textSize="14sp"
android:textStyle="bold"
/>
这是my_outline.xml:(注意角标记)
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:topLeftRadius="10dip"
android:bottomRightRadius="10dip"/>
<padding
android:left="50dip"
android:top="5dip"
android:bottom="5dip" />
<solid
android:color="#0fff" />
<stroke
android:width="1dip"
android:color="#f0f0f0" />
</shape>
图片:
将形状更改为:
<corners
android:topLeftRadius="10dip"
android:bottomLeftRadius="10dip"/>
并且您可以清楚地看到底角是倒置的(所有情况都会发生,我剪掉“星期三”只是为了说明)。这是我手机的图片(Nexus S 2.3.2,但也发生在模拟器上):
你知道这一点吗?我查看了谷歌(“android shape invertedcorner”),但一无所获。这里也没有“相关问题”。
I was playing with corners, and I was intrigued with this behavior. XML layout:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/list_header_title"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:padding="10dip"
android:gravity="center_vertical"
android:background="@layout/my_outline"
android:text="Example"
android:textSize="14sp"
android:textStyle="bold"
/>
This is my_outline.xml: (pay attention to the corners tag)
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:topLeftRadius="10dip"
android:bottomRightRadius="10dip"/>
<padding
android:left="50dip"
android:top="5dip"
android:bottom="5dip" />
<solid
android:color="#0fff" />
<stroke
android:width="1dip"
android:color="#f0f0f0" />
</shape>
Picture:
Change the shape to:
<corners
android:topLeftRadius="10dip"
android:bottomLeftRadius="10dip"/>
And you can clearly see that the bottom corners are inverted (happens with all, i cut "Wednesday" just to illustrate). This is a picture of my phone (Nexus S 2.3.2, but happens on the emulator as well):
Are you aware of this? I looked at Google ("android shape inverted corner"), and got nothing. Here on SO there are no "related questions" as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这是一个值得注意的错误。有关更多链接和参考信息,请参阅此答案。 :P
Yup, it's a noted bug. See this answer for more links and reference info. :P