I've got a TextView. When multi-line text inside is short and fit to available space I set gravity to top:
tv.setGravity(Gravity.TOP);
When the text is longer than space in TV I'd like to show only the end of text by:
tv.setGravity(Gravity.BOTTOM);
Layout:
<RelativeLayout
android:id="@+id/textLayout"
android:layout_marginTop="16dp"
android:layout_width="fill_parent"
android:layout_height="110dp"
android:orientation="vertical"
android:visibility="visible" >
<TextView
android:id="@+id/tv"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:gravity="top"
android:text="Long text bla bla."
android:textColor="@android:color/black"
android:textColorHint="@android:color/black"
android:textSize="37sp" />
...
</RelativeLayout>
What is the simplest solution to check if text (in many lines) is longer than available space (I don't want to hardcode number of lines because size is different for different screens)? Is there any indicator?