List View In Libgdx
Asked Answered
A

3

7

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.

enter image description here

Agni answered 24/12, 2013 at 12:29 Comment(0)
A
1

I came accross with the alternative solution. implements gestureListener provided by Libgdx and used pan method.

Agni answered 17/1, 2014 at 11:13 Comment(2)
Please add the information of where you found the solution.Nordic
please add more information and make it a complete answer.Risibility
T
2

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.

Territerrible answered 25/12, 2013 at 9:2 Comment(0)
O
2

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;
}
Organist answered 16/1, 2021 at 19:42 Comment(0)
A
1

I came accross with the alternative solution. implements gestureListener provided by Libgdx and used pan method.

Agni answered 17/1, 2014 at 11:13 Comment(2)
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.