Fragment activity catch onKeyDown and use in fragment

后端 未结 6 645
别那么骄傲
别那么骄傲 2020-12-09 08:28

I have Fragment activity with pager:

List fragments = new Vector();
    fragments.add(Fragment.instantiate(this, PastEventLis         


        
6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-09 09:09

    I have the same problem in developing Android TV app.

    And I solve this problem like this:

    In onCreateView method, I call "requestFocus" by some View. (I mark it as ViewA.) Then I set KeyEventListener to ViewA.

    In your case, you should do it (set-KeyEventListener) in Adapter and PagerChangeListener.

提交回复
热议问题