Gmail Android app, such as viewing a list with a letter in the icon

I am looking for a solution similar to the list of emails in the gmail application for Android, I want the list to be deleted in order to have a name and an icon with the first title symbol. in my application, this will be used to display some names in the application from the database table, so this icon will look like in the gmail application with the first letter of the name and then next to it. Swiping will make it possible to delete.

here is a screenshot for reference (I would use only the name, icon on the left and time!)

enter image description here

UPDATE

Now I plan to use TextDrawable , as EUGEN reported. Now I have this problem. The Sample adapter provided in the sample library folder uses listarry as a data set.

private List<ListData> mDataList = Arrays.asList( new ListData("Iron Man"), new ListData("Captain America"), new ListData("James Bond"), new ListData("Harry Potter"), new ListData("Sherlock Holmes"), new ListData("Black Widow"), new ListData("Hawk Eye"), new ListData("Iron Man"), new ListData("Guava"), new ListData("Tomato"), new ListData("Pineapple"), new ListData("Strawberry"), new ListData("Watermelon"), new ListData("Pears"), new ListData("Kiwi"), new ListData("Plums") ); 

I need to use data in the form of an array of strings. I am new to the list of arrays and adapters, so I need help!

+5
source share
5 answers

I am using the TextDrawable library. The point is: when you have a photo of the user, you show the photo, otherwise a letter. So it’s easier to have only one ImageView instead of having a TextView above it.

+15
source

Although I used the TextDrawable library , as @Eugen Pechanec suggested, I would like to add another librray that I found is called RoundedLetterView

RoundedLetterView, as in Android 5.0 Contacts enter image description here

+8
source

I did this by setting the TextView Background to any random color that I already defined in color.xml. If I find the image in the adapter image, and if I do not find the image, then the random color is set as the background of the text text with large text in it. If you need any shape like oval circle, etc. Create xml in drawable. Use this xml as the background of the TextView. Hope this helps.

+3
source

You can use the link https://github.com/romannurik/android-swipetodismiss to scroll through the transition list and a TextView with the same width and height is enough for the icon.

+2
source

Check out these colored material icons pre-generated as 512x512 PNG files:

Demo

https://github.com/eladnava/material-letter-icons

+2
source

Source: https://habr.com/ru/post/1210358/


All Articles