如何设置TextView结构的颜色?

时间:2012-01-13 13:00:29

标签: android textview

是否有任何可能的方法来设置TextView周围的边框,如下图所示? 第一张照片是我目前得到的,第二张照片是我想要的边框。 LinearLayout中包含的所有元素都只是单独的textViews 这么多的帮助~~ enter image description here

enter image description here

2 个答案:

答案 0 :(得分:2)

您可以将TextView背景设置为具有背景和边框的xml形状,如下所示:

<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
        <solid android:color="#191919" />
        <stroke android:width="1dp" android:color="#191919"/>
  </shape>

您可以更多地了解这个here

答案 1 :(得分:1)

我认为你可以这样做,请查看以下链接:Android - Way to appear bordered text on the TextView?这可能有助于解决你的问题。