Focus problem with dpad

by tikky » Wed, 09 Dec 2009 01:08:08 GMT

Sponsored Links
I have a a simple activity with  a list view. Each element of the list
view contains a photo, text view and a button. I have an
onClickListener() implemented for the button.
When I touch the button, onClickListener gets called, which is what I
want. But when I use the D-PAD, and press down key, the entire list
item gets focus, so the center-select key takes no effect. I need the
focus to go only to the button instead of the entire list element, so
that when center key is pressed, it will do the same action as in the
touch mode.

How can I achieve this?
I have tried calling requestFocus() on the button, but still it does
not work.


Focus problem with dpad

by tikky » Tue, 22 Dec 2009 01:18:46 GMT

 I was able to get this working by calling:

Now the button gets focus when navigating with D_PAD.
But now I face another issue.

The textview does not get highlighted when selected. Is there anyway I
can get the textview to be highlighted when focussing on it?



Sponsored Links

Other Threads

1. concept: app that pulls data from a website

hello.  i'm totally new to this.  so my idea was to create an app that
would display daily quotes from a website.  this seems rather odd
because someone could just go to that website and look at the daily
quotes.  is it worth creating an app for that?  are there apps for
this type of thing?



2. including an XML-defined layout in another XML-defined layout

I have a LinearLayout defined in XML that is my parent, and another
one which (sometimes) I want to include in the parent.  I want to keep
the optional sub-layout a separate file so it can be used elsewhere.

I have tried creating an empty layout within the parent one, but my
efforts to findViewById() on it onCreate() give a null pointer.

How do I do this?



3. HTML sanitization

4. Tab content from different layout

5. Remote display for demo

6. Writing to file Assets folder

7. Installing Apps on Acer Netbook Running Android