Android Question Centered items in Horizontal Customlistview

I've added Customlistview (Horizontal List Orientation) and added several labels/views in runtime to scroll horizontally. It's Okay if there are many elements, so the user can scroll and the views are filled in the Customlistview. Suppose there is only a single element/view, it's aligned/added to the left of the Customlistview.

Is there any way we can center those views in the center?
 

Attachments

  • Screenshot 2023-01-08 195201.png
    Screenshot 2023-01-08 195201.png
    92.8 KB · Views: 131
  • Screenshot 2023-01-08 195226.png
    Screenshot 2023-01-08 195226.png
    13 KB · Views: 133

LucaMs

Expert
Licensed User
Longtime User
I've added Customlistview (Horizontal List Orientation) and added several labels/views in runtime to scroll horizontally
You should add items (panels with other views) to the CustomListView and I hope you did.

You can use a trick: add two empty and transparent items, one before and one after the concrete one to be centered.

Of course you should also delete them when they are no longer needed.
 
Upvote 0
You should add items (panels with other views) to the CustomListView and I hope you did.

You can use a trick: add two empty and transparent items, one before and one after the concrete one to be centered.

Of course you should also delete them when they are no longer needed.
will try. thank you
 
Upvote 0
Top