围绕文本的Andr​​oid平局圈平局、文本、Andr、oid

由网友(旧城不忘少年心)分享简介:我有它的单个字符(所有的个位数的0 - 9)一个TextView。我想画一个圆或周围数平方。我看到使用的是九补丁样式它周围的线程提,但我unsrure如何做到这一点(或者是做到这一点的最好办法)。怎样才可以有各地的数了一圈? I have a textView with a single character in...

我有它的单个字符(所有的个位数的0 - 9)一个TextView。我想画一个圆或周围数平方。我看到使用的是九补丁样式它周围的线程提,但我unsrure如何做到这一点(或者是做到这一点的最好办法)。怎样才可以有各地的数了一圈?

I have a textView with a single character in it (all single digit numbers 0 - 9). I'd like to draw a circle or a square around the number. I saw a thread mention using a nine-patch to style around it, but i'm unsrure of how to do this (or if it is the best way to do it). How can i have a circle around the number?

感谢

推荐答案

只需要创建一个圆形绘制这样

Just need to create a round drawable like this

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="oval">
    <corners android:radius="10dip"/>
    <stroke android:color="@color/red" android:width="2dip"/>
    <solid android:color="@android:color/transparent"/>
</shape>

和设置该绘制为您TextView的背景。

And set this drawable as your TextView background.

阅读全文

相关推荐

最新文章