4

I want to show custom graph view with horizontal & vertical scroll in view something like thisListView with bar Chart.

no of columns are dynamic according no of events for particular time. no of rows are fixed.

how to achieve this view in android?

and also required the click listener on each graph item. any suggestion pls.

Yograj Shinde
  • 839
  • 12
  • 23
Mehboob Maniyar
  • 238
  • 1
  • 3
  • 11

1 Answers1

1

First I assume you use image view for each of the colored rectangle. My suggestion is:

  1. For each of the event, create a onClickListener, in which you handle the click event.
  2. In the getView function of the listview, assign the onClickListener to the image view according to the event..
Lei Chen
  • 699
  • 1
  • 5
  • 13
  • That's fine but how i can achieve that UI that's the big issue. – Mehboob Maniyar Dec 15 '14 at 07:28
  • Sorry, I thought you have already implemented the UI. To achieve that UI, I will use a [grid layout](http://developer.android.com/guide/topics/ui/layout/gridview.html) – Lei Chen Dec 15 '14 at 07:32
  • If the range of hours and number of columns are fixed, you can even use relative layout directly. Use image view for each event, programmatically add/remove them ,and set their positions and dimensions. – Lei Chen Dec 15 '14 at 07:41