這是我的繪製代碼:機器人 - 爲什麼自定義繪製不影響TextView的
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners
android:bottomLeftRadius="7dp"
android:bottomRightRadius="7dp"
android:topLeftRadius="7dp"
android:topRightRadius="7dp" />
<solid android:color="#3C1251" />
</shape>
這就是所謂的haraj.xml在我的繪製文件夾中的XML文件。
這是我的XML佈局:
<TextView
android:id="@+id/harajamount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:gravity="center"
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp"
android:textColor="#fff"
android:textSize="15sp"
android:padding="8dp"
android:background="@drawable/haraj"
android:text="2500"
/>
奇怪的是它沒有影響的TextView。我得到沒有背景顏色和沒有角落的textview。
我在做什麼錯?
將此文本視圖置於任何類型的佈局中並設置背景爲那個佈局。 – iffu 2015-02-24 07:38:39
@iffu沒有工作,我試過了 – 2015-02-24 08:12:29
好吧等待我現在工作,並給你的解決方案 – iffu 2015-02-24 08:14:17