How do I tell if my textview has been ellipsized?

前端 未结 14 1670
天涯浪人
天涯浪人 2020-11-30 19:31

I have a multi-line TextView that has android:ellipsize=\"end\" set. I would like to know, however, if the string I place in there is actually too

14条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-30 20:11

    This worked to me:

    textView.post(new Runnable() {
                            @Override
                            public void run() {
                                if (textView.getLineCount() > 1) {
                                    //do something
                                }
                            }
                        });
    

提交回复
热议问题