How to get number of lines of TextView?

前端 未结 10 2488
萌比男神i
萌比男神i 2020-11-28 09:29

I want to get the number of lines of a text view

textView.setText(\"Test line 1 Test line 2 Test line 3 Test line 4 Test line 5.............\")
10条回答
  •  臣服心动
    2020-11-28 10:17

    textview.getText().toString().split(System.getProperty("line.separator")).length
    

    It works fine for me to get number of lines of TextView.

提交回复
热议问题