0

i am making an application with 4 buttons in it.I want to get them the focus whenever the mouse or some pointer moves over them.But i am not able to do that.Please tell me what is the problem. The coding of buttons is as follows.

            m_NextButton.requestFocus();
    m_PrevButton.requestFocus();
    m_SubmitButton.requestFocus();
    m_SkipButton.requestFocus();

The xml coding is as follows:

<?xml version="1.0" encoding="utf-8"?>
<selector
  xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@drawable/button_blue"/> 
    <item android:state_focused="true" android:drawable="@drawable/button_blue"  /> 
    <item  android:drawable="@drawable/button_lightgreen" />

</selector>

Thanks in advance.

Naseeb Sheoran
  • 423
  • 2
  • 8
  • 21

2 Answers2

0

This seems to be quite tricky actually but not impossible. I did some digging in Google and found a similar question in Stack overflow:

How to set the focus on button?

And it has a link leading here that helped the guy solve his problem : Stop EditText from gaining focus at Activity startup

Community
  • 1
  • 1
Loic O.
  • 486
  • 2
  • 7
  • 22
0

No mouse in Android, no hoover in android like web... The Galaxy Note can have hoover event, but by its 'stylus' only.

xtr
  • 5,870
  • 1
  • 21
  • 23