简体   繁体   中英

How to program a split screen keyboard?

I am developing an IME app, but I am having troubles understanding the InputMethodService structure. My main service class extends InputMethodService and on the onCreateInputView it returns my custom Linear view.

The part I don't understand is the InputMethodService renders the view at the lower part of the screen, the entire width. This is the part where my knowledge falls short. I have studied the Android Developer, but, as of yet, to no avail.

My question is how to render a split screen keyboard?

I see two possibilities. Either I can manipulate the underlying window that InputMethodService renders at the bottom of the screen with some value set, or my class should extend the AbstractInputMethodService and render its own UI. The latter I would have to learn more.

You return a custom view in onCreateInputView. In the custom view you have 3 views- the left side, the right side, and the middle. In the middle, make its background transparent. Make the background of the root view transparent as well. It should show through.

Then move to onComputeInsets. This controls where on the screen your view is. Tell it that the contentInset is -view.getHeight(). This will cause it to not move the background app up at all when displaying your keyboard.

If you want to make the space in between touchable with touches going through to the main app, you need to play with the touch insets as well.

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