0

I have a ImageView with a TextView and Button. I have it currently in a custom list view, but I noticed now that I don't need to show more as one element (object). So I actually don't need a Listview to show the row (list entry). How can I show the list entry without a Listview?

Iamat8
  • 3,888
  • 9
  • 25
  • 35
Matej
  • 147
  • 2
  • 12

2 Answers2

1

You can put the elements of your custom listview item into a Layout, e.g. LinearLayout and simply add it to your activity's layout where you needed it. You can set an OnClickListener for that layout, so user can click the whole thing.

Ridcully
  • 23,362
  • 7
  • 71
  • 86
  • But where can I define the position of the LinearLayout in my MainActivity? – Matej Sep 30 '15 at 12:58
  • That depends on your MainActivity's layout. You can treat Layout elements like View elements within an outer Layout. If you post your MainActivity's layout and tell me where you want the LinearLayout placed, I can surely point it out for you. – Ridcully Oct 01 '15 at 07:26
0

I think you should use ListActivity. Then you can set up empty view for list. Here some tutorial: ListActivity and ListView Tips. Also you can implement that logic with Recycler view by yourself or use library. Here is solution from stackoverflow

Community
  • 1
  • 1
Silvestr
  • 704
  • 4
  • 13