本文介绍了创建圆角上角被拉伸和底部边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我想出了。

<?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item>
        <shape android:shape="rectangle" >
            <solid android:color="@color/grey" />

            <padding
                android:bottom="1dp" />
            <corners
                android:radius="0dp"/>
        </shape>
    </item>
    <item>
        <shape android:shape="rectangle" >
            <solid android:color="@color/white" />
            <corners
                android:radius="1dp"
                android:bottomRightRadius="0dp"
                android:bottomLeftRadius="0dp"
                android:topLeftRadius="5dp"
                android:topRightRadius="5dp"/>
        </shape>
    </item>
</layer-list>

然而,这是工作底部半径显示出来我把什么值就可以了。

This is working however the bottom radius is showing up whatever values I place on it.

其实只需要在 topLeftRadius ,使它看起来像这样

Actually in only takes the topLeftRadius to make it looks like this

    <corners
        android:bottomRightRadius="0dp"
        android:bottomLeftRadius="0dp"
        android:topLeftRadius="5dp"
        android:topRightRadius="0dp"/>

推荐答案

我有同样的问题,试试吧。它为我工作的罚款。我只是添加的android:顶部=10dp第二项。因此,它会导致圆刚上角。

I had same problem, try it. it worked for me fine. I just add android:top="10dp" to second item. So, it causes to round just top corners.

<?xml version="1.0" encoding="utf-8" ?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <solid
                android:color="@color/dialog_title_bar_blue"/>

            <corners
                android:topLeftRadius="10dp"
                android:topRightRadius="10dp"/>
        </shape>
    </item>
    <item
        android:top="10dp">
        <shape android:shape="rectangle">
            <solid
                android:color="@color/dialog_title_bar_blue"/>
        </shape>
    </item>
</layer-list>

这篇关于创建圆角上角被拉伸和底部边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 09:44