0

I am new to android development, and I am trying to develop an simple android application for google tv and would like to create a tabbed layout similar to the leftNavBar library provided in the googletv-android-sample or just using the original actionbar tabs layout. However, I am looking for a solution to attach the onFocus event to the tab so that i can switch the content fragment when a tab gains focus, instead of selected event. Thank you.

An approach is given here by implementing onfouschangelistener on leftnavbar library.

Change ImageView when Tab Focus changes

Any other thoughts would be appreciated thank you.

Community
  • 1
  • 1

1 Answers1

0

It is unclear what you are asking - please revise your question. Why do you want to use onHover? why is using OnFocusChangeListener an issue?

Example onFocusChange:

public void onFocusChange(View view, boolean hasFocus) {
  if(hasFocus){ 
      view.setBackgroundColor(Color.RED);
  } else {
      view.setBackgroundColor(Color.TRANSPARENT);
  }
} 
Krispy
  • 1,098
  • 1
  • 7
  • 11
  • OnFocus event would actually serve the my purpose, but I had trouble working it out with the action bar with navigation tab view. The only event I could get was selected event inherited from TabListener. – television-addict Jan 10 '13 at 00:17
  • what about using the OnItemSelectedListener - the navigation tab is a list - http://developer.android.com/reference/android/widget/AdapterView.OnItemSelectedListener.html – Krispy Jan 10 '13 at 16:38