且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

android中的textview.getLineCount始终为0

更新时间:2023-01-28 11:43:37

我知道这个问题已经很老了,但万一有人来这里寻找实际答案:

I know this question is quite old, but in case anyone comes here looking for the actual answer:

holder.text2.setText(arr2[position]);
holder.text2.post(new Runnable() {
    @Override
    public void run() {
        int lineCnt = holder.text2.getLineCount();
        // Perform any actions you want based on the line count here.
    }
});