双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

android用shape给linearLayout设置边框,怎样只保留底部或顶部的边框,把其它三个方向的边框去掉呢?

yingyoulan yingyoulan 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
下面是我的测试代码,最终效果LinearLayout有灰色边框,要怎样保留底部或顶部的边框,其它三个方向的边框去掉?
boder.xml

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

<stroke
android:width="0.01dp"
android:color="#C6C7CE" />
<padding
android:bottom="5dp"
android:top="5dp"
android:left="5dp"
android:right="5dp" />

</shape>


text.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical" android:gravity="center"
android:background="@drawable/boder" >

<TextView android:layout_width="fill_parent" android:layout_height="wrap_content"
android:text="@string/log_name"/>

</LinearLayout>

</LinearLayout>
...全文

相关推荐

评论 15
收藏 已收藏
分享
返回顶部
yingyoulan
Android 80,489 成员 91,375 内容