I have asked a question previously titled "Android: Ruled/horizonal lines in TextView" at Android: Ruled/horizonal lines in Textview . But I haven't got required answer. So I'm planing to do this by drawing line on TextView by java.Is there any way to draw Line inside TextView? or if I get end of line from java code then I'll be able to add textview for each line. Any help will be highly appreciated.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
I'm using the technique of drawing lines between each line of text in EditText and then I will make the EditText non-editable by setting setKeyListener(null) to the custom EditText object so that, the EditText acts like a TextView :)
A custom EditText that draws lines between each line of text that is displayed:
Now use object of LinedEditText class where you need your TextView and make it non-editable.
An Example:
et.setKeyListener(null) makes the EditText non-editable so, it acts like a TextView.
The Output:
Issue with cursor:
If you use et.setKeyListener(null) only then it is just not listening to keys but user can see a cursor on the EditText. If you don't want this cursor just disable the EditText by adding this line:
I don't know why do you want a line inside a textview. If you want to draw a horizontal single line just put this code between the textviews that you are reading from the db, obviously in your layout xml file:
<View android:background="#colorYouWant" android:layout_width = "fill_parent" android:layout_height="1dip" android:id="+@id/horizontalLine"/>
Adjust the separation by java coding doing this in the related java code:
The left, top, right, bottom parameters are the ones that you have to change.