如何獲取TextView
的可見部分顯示的行數?我使用的文字不完全放在TextView
的每個屏幕分辨率上。如何確定在TextView中可見的行數?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/logs_text"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
String s = "very big text"
TextView logText = (TextView) view.findViewById(R.id.logs_text);
logText.setText(s);
你想設置的TextView將有多少行有,或者只是得到他有多少行? – Giacomoni
轉載問題 – umni4ek
使用textviewobject.getText()獲取文本視圖上的文本並與原始文本進行比較。 – Meenal