Reputation: 3831
I am looking for a solution like the emails list in gmail's android app, I want a list with swipe to delete and to have title and an icon with the first character of the title. in my application this will be used to show some names in the app from a database table, so there will be this icon like in the gmail app with the first letter of name and then the name next to it. Swiping will give an option to delete.
here is the screenshot for reference (I would be using just the title ,the icon on left and time ! )
UPDATE
Now I am planning to use TextDrawable as EUGEN advised. Now I have this issue, The Sample adapter provided in sample folder of the library, uses listarry as dataset
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 have to use data in the form of string array. I am new to list arrays and adapters so I need help!
Upvotes: 6
Views: 25561
Reputation: 7906
Check out these Material-colored letter icons, pre-generated as 512x512
PNG files:
https://github.com/eladnava/material-letter-icons
Upvotes: 2
Reputation: 307
I did it by setting TextView's Background any random color that I already defined in color.xml. If I find the image in adapter image is displayed and if I don't find an image random color is set as textview background with BIG text in it. If you need any shape like circle oval etc then create xml in drawable. Use that xml as a background of TextView. I hope it helps.
Upvotes: 3
Reputation: 3831
Although I used TextDrawable library as suggested by @Eugen Pechanec , I would like to add another librray that I found called RoundedLetterView
RoundedLetterView like the one in Android 5.0 Contacts app
Upvotes: 8
Reputation: 38223
I use the TextDrawable library. The point is this: when you have the user's photo, you display the photo, otherwise the letter. So it's easier to only have one ImageView
instead of having an extra TextView
on top of it.
Upvotes: 16
Reputation: 3885
For the Swipe to delete listview you can use the link https://github.com/romannurik/android-swipetodismiss and for the icon , a TextView with same width and height is enough .
Upvotes: 2