Bulk Emailing

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Saturday, 7 August 2010

Overlay on Android ListView

Posted on 18:58 by Unknown
I was searching for some solution to display an Overlay on ListView, just like what I can do over the MapView. As Android Framework doesn't support multi-hierarchy views in Z-Axis, so it looks challenging. The solution lies behind overwriting standard ListView. The benefit from this feature is multiple, you can display your custom popup over list and there are many more use cases.
In the above screen shot, I have displayed my "selection palette" (Map Pin Icon and List Icon) at the bottom. You can hide/show the palette by clicking the "green triangle" section.


How I can do that-
There are 2 steps-

1. Drawing-
The trick is overriding dispatchDraw(Canvas canvas) method of ListView. This method gets called from Android Framework once List drawing is over. So, whatever you draw inside of dispatchDraw(Canvas canvas), comes in the foreground. You get drawing control over the whole screen, so you can draw popup at anywhere on the screen.

2. Click Event Handling-
To intercept user click events, you need to define Region and need to restrict ListView to handle clicks which falls under your custom Region. You can read my previous post on Region handling in Canvas.
To intercept click events, you need to overwrite onTouchEvent(MotionEvent e).

You can download the complete source from here.
Email ThisBlogThis!Share to XShare to Facebook
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • CityWeather
    Update: Release 1.1 has been uploaded. It will now provide weekly forecast of your selected cities. Download   CityWeather is an Android...

Blog Archive

  • ►  2013 (6)
    • ►  September (2)
    • ►  May (1)
    • ►  April (1)
    • ►  February (1)
    • ►  January (1)
  • ►  2012 (4)
    • ►  July (2)
    • ►  March (1)
    • ►  January (1)
  • ►  2011 (11)
    • ►  November (1)
    • ►  October (2)
    • ►  August (1)
    • ►  June (1)
    • ►  April (2)
    • ►  March (3)
    • ►  January (1)
  • ▼  2010 (27)
    • ►  December (2)
    • ►  November (3)
    • ►  September (2)
    • ▼  August (4)
      • Overlay on Android Layout
      • Overlay on Android ListView
      • Region Handling in Android Canvas
      • Image Geo Tagging for Android
    • ►  July (4)
    • ►  June (7)
    • ►  May (5)
Powered by Blogger.

About Me

Unknown
View my complete profile