简体   繁体   中英

Difference between RequestFocus and ReqeustFocusFromTouch?

Want to know the actual difference between RequestFocus and ReqeustFocusFromTouch . When should each be used, how should each be used, and in which situations is each helpful?

Give some examples and explain them in detail.

From official doc

requestFocus()

  • Call this to try to give focus to a specific View or to one of its descendants. A View will not actually take focus if it is not focusable ( isFocusable() returns false),

requestFocusFromTouch

  • Call this to try to give focus to a specific view or to one of its descendants. This is a special variant of requestFocus() that will allow views that are not focusable in touch mode to request focus when they are touched.
  • Returns boolean Whether this view or one of its descendants actually took focus.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM