kalpana c
kalpana c

Reputation: 2739

Set x and y coordinates of Listview item programmatically android

I use listview. But I want to set x and y position of listview item. Ex: I want like this below draw image. Is it possible? If yes give me any idea or if no then give me another suggestions.

 ---------------------
|                     | 
|  |start point       |   
|                     |
|---------------------|
|                     |
|      |start point   | 
|                     |  
----------------------

Upvotes: 0

Views: 989

Answers (2)

Luciano
Luciano

Reputation: 2796

  • Create a custom ArrayAdapter
  • Override the getView of a ArrayAdapter
  • Create in the getView your row layout or use a your row layout from a xml layout resource
  • For the row layout, you can't (easy) use x and y. You can use android:layout_margin or something like that for positioning

for more info, here is a tutorial: http://www.vogella.com/articles/AndroidListView/article.html

Upvotes: 2

Anis BEN NSIR
Anis BEN NSIR

Reputation: 2555

Within your customer adapter, on the getView method, set the X margin or padding for your raw layout, depending on your condition.

Upvotes: 1

Related Questions