this is my drawable code:
<?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>
This is a xml file called haraj.xml in my drawable folder .
This is my xml layout :
<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"
/>
Strangely it's not effecting textview. I get textview with no background color and no corners .
What am I doing wrong?
Whats your background right now? Hope it will not be the #3C1251. Because i have just try with your code. Its working perfect and giving proper background to textview with color.
Hope you might get any help. Let me know if its not working...
Enjoy Coding... :)
try this
<corners android:radius="7dp"/>
instead of
<corners
android:bottomLeftRadius="7dp"
android:bottomRightRadius="7dp"
android:topLeftRadius="7dp"
android:topRightRadius="7dp" />
try this
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<corners android:radius="10dp" />
<solid android:color="#3C1251" />
<size android:height="23dp" />
</shape>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.