i want to know how many line in my text view. i already set mytextview text, then i want to get how many line it take in mytextview.
i use mytextview.getLineCount() but it didn't work. it always return 0.
can someone helpme.
public int getEllipsisCount (int line): Returns the number of characters to be ellipsized away, or 0 if no ellipsis is to take place. So, simply call : int lineCount = textview1.
You need to post method for fetching the lines counts. Here is the sample code
imageCaption.setText("Text Here");
imageCaption.post(new Runnable() {
@Override
public void run() {
int lineCount = imageCaption.getLineCount();
Log.v("LINE_NUMBERS", lineCount+"");
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With