How to draw lines in Android Edit Text?

I am trying to create a notebook application. I want to have lines in the Edit Text view of my application, which is the multi-line text Edit Text. Please let me know how to do this. Thanks for your time and advice.

+4
source share
4 answers

check this. notepad

+3
source

I think it's best for you to show the background, rather than draw lines. Use the default background, which looks like this:

http://developer.android.com/reference/android/view/View.html#setBackgroundResource(int )

0
source

Since the size of the notebook will vary depending on the screen size of the phone, a good option would be to create a canvas with the specified size and draw a line horizontally down the canvas in a constant interval. Then convert the canvas to drawable and set the backgrounddrawable from editText to drawable.

0
source

u can have this code in yr xml folder in res

  <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"> <stroke android:width="1dp" android:color="#FF000000" /> <padding android:bottom="20dip" /> </shape> 

and include it in setBackgroundResource()

0
source

All Articles