Use shape drawable (a rectangle) as background for the textview.

Like

In Layout:

<TextView android:text="Android Textview" android:background="@drawable/boder"/>

Rectangle drawable boder.xml (put into res/drawable folder):

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
   <solid android:color="#ffffff" />
   <stroke android:width="1dip" android:color="#0f6d96"/>
</shape>

Note:

Use #00000000 for the solid color to have a transparent background

Another Way

<LinearLayout android:orientation="vertical"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent">
        <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp"
                android:layout_marginLeft="10dp"
                android:text="Android demo"
                android:id="@+id/title_label"
                android:gravity="center_vertical"/>
        <View
                android:layout_width="fill_parent"
                android:layout_height="0.2dp"
                android:id="@+id/separator"
                android:visibility="visible"
                android:background="@android:color/darker_gray"/>

    </LinearLayout>

 

For More Click Link Below:

http://helptodevelopers.blogspot.in/2016/02/how-to-put-border-around-textview-in.html

 

Recent Comments

0 Comments

Sign In To Leave a Comment

Type your Comment below and click to send comment

error: function(jqXHR, textStatus, errorThrown) { alert(errorThrown); }