Attaching a custom view to the top of the Android keyboard

What is the simplest way to attach the layout defined in the xml at the top of the android soft keyboard. This view should only appear when the keyboard appears.

+3


source to share


3 answers


I think the best way is to detect when the keyboard appears and then pin the view to the bottom of the screen (it will be above the keyboard after resizing the whole layout).



0


source


I think this post has a lot to do with this other: How to draw a view over a soft keyboard like WhatsApp? and there are several solutions for this problem.



0


source


I think this is the best way to do it.

  • Define a layout resource file to be used as a custom view

  • Create a method that inflates this layout resource file and returns it as a view: Code Snippet

    public View returnPayKeyView () {
    View simpleView = getLayoutInflater (). Inflate (R.layout.simpleresource, null);

    return simpleView;

    }

  • Set this returned view as candidates using setCandidatesView method

The returned view will be displayed above your keyboard using the bloated xml layout resource.

0


source







All Articles