您的位置:首页 > 其它

实现的是蓝色的四个TextView边框,但是我想要的是只实现三个边框(顶部、左和顶部)

2014-11-14 14:50 375 查看
<
selector

xmlns:android
=
"http://schemas.android.com/apk/res/android"
>

<
item

android:state_pressed
=
"true"
>

<
shape
>

<
solid

android:color
=
"#449def"
/>

<
stroke

android:width
=
"1dp"

android:color
=
"#2f6699"
/>

<
corners

android:radius
=
"0dp"
/>

<
padding

android:left
=
"5dp"

android:top
=
"5dp"

android:right
=
"5dp"

android:bottom
=
"5dp"
/>

</
shape
>

</
item
>

<
item
>

<
shape
>

<
gradient

android:startColor
=
"#ffffff"

android:endColor
=
"#ffffff"

android:angle
=
"270"
/>

<
stroke

android:width
=
"1dp"

android:color
=
"#2f6699"
/>

<
corners

android:radius
=
"0dp"
/>

<
padding

android:left
=
"5dp"

android:top
=
"5dp"

android:right
=
"5dp"

android:bottom
=
"5dp"
/>

</
shape
>

</
item
>
</
selector
>
这是一个比较快的解决方案(也可能是愚蠢的),在你的TextView加上
android:translationX="2dp"
,这样你就可以加
android:paddingRight="2dp"
来补上剩下那个地方
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息