加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

在可见的xml,3边的android视图上创建边框?

发布时间:2020-12-16 07:53:24 所属栏目:百科 来源:网络整理
导读:我想为我的 Android按钮绘制一个可绘制,定义为drawable.我发现我可以使用一个矩形来设置所有的边框,但是当我想要三边时,我有点卡住了.我想要的例子有顶部或底部打开. 有没有人会告诉我怎么做? 尝试这样做,虽然我在其他一些帖子中看到了 ?xml version="1.0"
我想为我的 Android按钮绘制一个可绘制,定义为drawable.我发现我可以使用一个矩形来设置所有的边框,但是当我想要三边时,我有点卡住了.我想要的例子有顶部或底部打开.

有没有人会告诉我怎么做?

尝试这样做,虽然我在其他一些帖子中看到了
<?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="#FFFFFF" />
    <padding
        //android:bottom="10dp"  Remove this to avoid seeing the bottom border 
        android:left="10dp"
        android:right="10dp"
        //android:top="10dp"  Remove this to avoid seeing the top border
    />

    <corners android:radius="5dp" />
</shape>
</item>
<item>
<shape android:shape="rectangle" >
    <padding
        android:bottom="5dp"
        android:left="5dp"
        android:right="5dp"
        android:top="5dp" />

    <solid android:color="#666666" />
</shape>
</item>
</layer-list>

https://stackoverflow.com/a/10133434/1244489

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读