I have a ListView but some of the text items in the list go beyond the width limit which word wraps. Normally this is fine; however, i'd like to show as many lines as possible in the ListView so is there a way to clip or limit to a certain character length and put the ellipsis at the end
example: This is a really long line of text that will wrap around
to this This is a really long line...
I've seen a few xml lines for a TextView
android:ellipsize="end"
android:singleLine="true"
which works for a TetView but not seeing anything for a ListView to do that (did try using those xml options but it didn't work)
the closest I found was the following
android:maxLines="1"
android:ellipsize="end"
which didn't work, unless it's a bug in Android Studio or maybe the emulator?
I'm using the latest updated version on a Windows 10 machine
Android Studio 2.1.3
Build #AI-143.3101438
jdk1.8.0_91
Thank you
EDIT XML code for the activity
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="com.example.danield.notes.MainActivity"
tools:showIn="@layout/activity_main"
android:padding="0dp">
<ListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/listView"
android:maxLines="1"
android:ellipsize="end"
android:textFilterEnabled="false"
android:layout_centerInParent="true"
android:layout_alignParentTop="false"
android:layout_alignParentLeft="false" />
</RelativeLayout>