How to customize focus navigation in a ViewGroup

by n179911 » Wed, 29 Jul 2009 10:29:33 GMT


Sponsored Links
 Hi,

I have a View Group and it has 2 focusable Views as its children.
I would like know how I can customize how focus is being passed
between these 2 Views. In other words, when I press the Down Key or
the Up Key in the emulator, i want to control which of these children
has focus.

I read the JavaDoc of ViewGroup, I see these 2 methods.

public View focusSearch (View focused, int direction)
public boolean requestFocus (int direction, Rect previouslyFocusedRect)

But I am confused which of these method I should over-ride to achieve
what I want.

Thank you for any advice.

Regards,

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. How to get the AID for application in android.

Hi,

How do i get the "AID" for the an application in android.

Regards,
Rahul

-- 

2. Scrolling large image - working good but slow

Hi all,

For a project, I'm displaying an image with sizes 800 x 600 and I've
implemented my custom scrolling (horizontal and vertical) - which is
works fine. However, my problem is that it's not fast enough. If you
continuously move your finger on screen for instance, scrolling is not
responding fast enough. There is a lag and you need to wait (say
400-500ms) for new scrolled image to be loaded.

Now below I described how I implemented scrolling and my question is
that

- How can I make it faster, if possible
- Is there any other better way to implement this.

Thanks in advance!!

--------------------------------------------------------

My custom scrolling solution:

* I have a Main activity, SurfaceView and a thread
* In main activity, I'm using GestureDetector and override onScroll
method.
* In onScroll method of activity, I'm passing values to SurfaceView's
"handleScrolling" method.
* In "handleScrolling" method, I'm calculating proper values and using
"newImage = Bitmap.createBitmap(myImage, starX, stopY, SCREEN_WIDTH,
SCREEN_HEIGHT)"; to create a new, "scrolled" image.

* Then in thread loop, I'm drawing this "newImage" to canvas.

Hope this much info helps.

-- 

3. How to switch off Anti-aliasing

4. Saving Intents to use later (WAY LATER!)

5. ListView Scroll behaviour

6. How to test if app is shown on Market for all screensizes

7. How can I know date changed? seems android.intent.action.DATE_CHANGED works not properly