I have arraylist of powerUps and I want to display as a List view and whichever row user selects get that particular power for specific time. All thing is done except I am not able to display arraylist items on listview in libgdx. I searched a lot but didnt get any idea. I want something like this.
List View In Libgdx
Asked Answered
I came accross with the alternative solution. implements gestureListener provided by Libgdx and used pan method.
Please add the information of where you found the solution. –
Nordic
please add more information and make it a complete answer. –
Risibility
If you want to use native android listview, you should refer this
But changing activity may not be such a good idea in most cases. So List class in scene2d would be a great choice here. You can simply initialize it with array of items and have a selection change listener to perform power-up selection. For more, refer this.
Use ScrollPane
The tutorialsface implemented a sample...
ScrollPane scrollPane = new ScrollPane(get_long_actor___like_List());
and sample of the get_long_actor___like_List()
:
private Actor get_long_actor___like_List() {
Table table = new Table();
//--------------------------------
for (int i = 0; i < 30; i++)
{
table.row().center().padTop(10);
table.add(new Label("Sample Item")).size(WIDTH, 50);
}
//--------------------------------
return table;
}
I came accross with the alternative solution. implements gestureListener provided by Libgdx and used pan method.
Please add the information of where you found the solution. –
Nordic
please add more information and make it a complete answer. –
Risibility
© 2022 - 2024 — McMap. All rights reserved.