Reputation: 3882
I want To create UI as shown below in android.
In above we can see textview over imageview i did it using framelayout. But my question is how do i achieve textview as shown below i.e if textview text is exceeding then ... is shown.How to achieve this effect in textview.
My xml code is shown below
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/grid_img"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/nature1"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello"
android:inputType="textMultiLine"
android:layout_gravity="bottom"
/>
</FrameLayout>
Upvotes: 0
Views: 414
Reputation: 7472
Try adding these lines to your TextView
:
android:maxLines="2"
android:ellipsize="end"
Upvotes: 5