Is there a simpler/better way to put a border/outline around my TextView?

喜你入骨 提交于 2019-12-02 22:01:09

You can probably get by with just custom_bg_2 if you add a <stroke> section:

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="#FFFFFF"/>
    <corners android:radius="3dp" />
    <padding android:left="10dp" android:top="10dp"
        android:right="10dp" android:bottom="10dp" />
    <stroke android:color="#439CC8" android:width="2dp" />
</shape>

Why not try stroke instead of solid?

According to Shape Drawable you can do something like:

<stroke android:width="2dp" android:color="#439CC8"/>

instead of <solid/> and then set it as your TextView background.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!