How can I position a layout right above the android on-screen keyboard?

前端 未结 3 1563
别跟我提以往
别跟我提以往 2020-12-12 23:02

See the attached photo. Twitter does it well. They have a layout, which I will call a toolbar for lack of a better term, right above the onscreen keyboard. How can I do this

3条回答
  •  鱼传尺愫
    2020-12-12 23:17

    Important addition to the answers above.

    When you work with DialogFragment fullscreen is applied implicitly.

    That means that you have to:
    1) set style in onCreate() of your DialogFragment:

    public class YourDialogFragment extends DialogFragment {
    ...
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setStyle(DialogFragment.STYLE_NORMAL, android.R.style.Theme_Holo_NoActionBar);
            }
    }
    

    2) if you use your own theme you should handle it like this:

    
    

提交回复
热议问题