1.获取TextView的行数(不能直接getLineCount()) final TextView totalTitleNo = (TextView) findViewById(R.id.tvacsub_account); ViewTreeObserver vto = totalTitleNo.getViewTreeObserver(); vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { @Override public boolean onPreDraw() { int lineCount = totalTitleNo.getLineCount(); System.out.println(lineCount); } });
技巧
标签: 技巧