【发布时间】:2013-03-01 12:12:54
【问题描述】:
我在 XML 中定义了一个 TextView,我想为其设置背景颜色和边框。
我遇到的问题是,在 XML 中我已经使用 android:background 设置边框资源,所以我不能再次使用它作为背景颜色。
有人可以指导我正确的方向吗?
边框.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="#ffffff" />
<stroke android:width="1dip" android:color="#7F000000"/>
</shape>
文本视图
<TextView
android:id="@+id/editor_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="@drawable/title_border"
android:padding="5dp"
android:text="@string/editor_title"
android:textAppearance="?android:attr/textAppearanceMedium" />
【问题讨论】:
标签: android background textview border background-color