Android:Draw line on a textview

后端 未结 2 1969
粉色の甜心
粉色の甜心 2020-12-05 08:46

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.

2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 09:22

    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:

    Adjust the separation by java coding doing this in the related java code:

    View horizontalLine = (View)findViewById(R.id.horizontalLine);
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    lp.setMargins(left, top, right, bottom);
    horizontalLine.setLayoutParams(lp);
    

    The left, top, right, bottom parameters are the ones that you have to change.

提交回复
热议问题