我有一个用XML定义的TextView,我想设置背景颜色和边框.我遇到的问题是在XML中我已经android:background用于设置边框资源,因此我无法再次使用它来获取背景颜色.有人可以指导我正确的方向吗?
Border.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>
Run Code Online (Sandbox Code Playgroud)
的TextView
<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" />
Run Code Online (Sandbox Code Playgroud)