android - How can I have a row separating line in TextView -


i want have line between each row in textview. can original textview this? if not, how can it?

separating line


answer:

thanks @slartibartfast reference , advice. made customized textview. , this.

textview line separator

this want!

the code:

public class linedtextview extends textview {  private rect mrect; private paint mpaint;  public linedtextview(context context) {     super(context);     initialize(); }  public linedtextview(context context, attributeset attrs) {     super(context, attrs);     initialize();  }  public linedtextview(context context, attributeset attrs, int defstyle) {     super(context, attrs, defstyle);     initialize(); }  private void initialize() {      mrect = new rect();     mpaint = new paint();     mpaint.setstyle(paint.style.stroke);     mpaint.setcolor(0x800000ff); }  @override protected void ondraw(canvas canvas) {      int cnt = getlinecount();     rect r = mrect;     paint paint = mpaint;     (int = 0; < cnt; i++) {         int baseline = getlinebounds(i, r);         canvas.drawline(r.left, baseline + 1, r.right, baseline + 1, paint);     }      super.ondraw(canvas); }  } 

use following line of code below textview

<view android:layout_width="fill_parent"     android:layout_height="1px"     android:background="@android:color/background_dark" /> 

you can configure according need.

you can use listview divider.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -