Flipboard / bottomsheet

Android component which presents a dismissible view from the bottom of the screen
BSD 3-Clause "New" or "Revised" License
4.53k stars 594 forks source link

BottomSheet appears in center of page #191

Open ampersanda opened 6 years ago

ampersanda commented 6 years ago

I am glad using this library because it's so simple to use. Sometimes, I have a problem with sheet when I after editing field like EditText, the sheet appears above the keyboard which is going to hide but as long as the keyboard hide first, it seems to be fine. My problem solved by hiding the keyboard programatically first then show the bottom sheet

View view = this.getCurrentFocus();
if (view != null) {
  Log.d(TAG, "View is not null");

  InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    if (imm != null) {
      imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
      bottomSheetLayout.showWithSheetView(view);
    }
}

Maybe this could help others :)