Reputation: 1028
I am trying to develop an app which, in landscape mode, it splits the activity in 2 fragments. In the first fragment, I have a listView which contains an icon and some text. My problem is, if the text is long enough, the text is shortened and 3 dots appears so that it shows the text is longer than that. How can I make the text extend on multiple rows so that the text is no longer shortened, but shown whole ?
I've searched for other answers, but I couldn't find any of them suiting.
The xml for each row looks like this:
<ImageView
android:id="@+id/ImageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="2dp"
android:contentDescription="@string/empty"
android:padding="1dp"
android:src="@drawable/icon" >
</ImageView>
<TextView
android:id="@+id/TextView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="2dp"
android:singleLine="true"
android:text="@string/text_view"
android:textStyle="bold" >
</TextView>
Thank you.
Upvotes: 0
Views: 309
Reputation: 27515
Try after removing android:singleLine="true"
line
As it forcing textview to show only in one line
<TextView
android:id="@+id/TextView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="2dp"
android:text="@string/text_view"
android:textStyle="bold" >
</TextView>
Upvotes: 1
Reputation: 2258
Try to change your TextView
to following:
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Dummy Text"
android:textColor="#000000"
android:lines="2" <!-- put this line if you always want to show 2 lines -->
android:textStyle="bold"
android:maxLines="2" <!-- max number of size... used when text is long -->
/>
Upvotes: 1