I have a ListView . I bring there some values ​​from the database, but sometimes they are too large.

I want to limit the number of displayed lines or characters and at the end to supplement all this with a triple-point ...

Perhaps there is some way to do this in the markup? Or do you have to do something with an array of databases?

 userCursor = db.rawQuery("select * from "+ DatabaseHelper.TABLE, null); String[] headers = new String[] {DatabaseHelper.COLUMN_DATECATEGORY, DatabaseHelper.COLUMN_NOTE}; userAdapter = new SimpleCursorAdapter(this, android.R.layout.two_line_list_item, userCursor, headers, new int[]{android.R.id.text1, android.R.id.text2}, 0); header.setText("Всего записей: " + String.valueOf(userCursor.getCount())); mList.setAdapter(userAdapter); 

    1 answer 1

    You need to use your own markup in the adapter and in it for TextView to register

     android:maxLines="1" android:ellipsize="end" 

    So the text will be limited to one line and, if not fit, will end in ellipsis