How to create a border in a text view

Asked 1 years ago, Updated 1 years ago, 74 views

Is it possible to draw a border around the text view?

android-layout android textview android-textview

2022-09-22 12:32

1 Answers

You can do it by designating the shape like a rectangle as the background on the drawable.

<TextView android:text="Some text" android:background="@drawable/back"/>

At the bottom, make a back.xml on the drawable and put the code at the bottom.

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

It's possible to make it transparent if you put it in 8 digits like #00000000 in solid color.


2022-09-22 12:32

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.