Arslan Ali
Arslan Ali

Reputation: 371

Custom background for Text View Using Xml drawable file

enter image description here

I want to make a textview background like in the screenshot. I have a xml file that can make rectangular background like in the screenshot but i am not able to do that below corner styling. I dont know what thing can change this. Here is my xml file that can give a rectangular background to my textview.

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >         
<stroke
      android:width="1dp"
      android:color="@color/orange" />

<solid android:color="@color/orange" />

<padding
       android:left="1dp"
       android:right="1dp"
       android:top="1dp" />

<corners android:radius="5dp" />
</shape>

Upvotes: 0

Views: 1068

Answers (1)

CaseyB
CaseyB

Reputation: 25060

Your best bet here would be to make a nine-patch image. Roman Nurik has made a really nice nine-patch generator that you can use. Then you just set the image as the background and it will stretch like you think it should.

Upvotes: 1

Related Questions