1. // implementation 'com.google.android.material:material:1.2.0'
  2. implementation this.rootProject.depsLibs.material
  3. implementation 'me.luzhuo.java.android:lib_core:1.0.28-SNAPSHOT'

1. show(View)

  1. private BottomSheetDialog dialog;
  2. public void OnClick(View _) {
  3. if(dialog != null) {
  4. dialog.show();
  5. return;
  6. }
  7. View view = LayoutInflater.from(this).inflate(R.layout.bottom_dialog_fragment, null, false);
  8. dialog = BottomDialog.instance().show(this, view);
  9. }

2. showMenu(String[])

Screenshot_20200901-112527.jpg

  1. private BottomSheetDialog dialog;
  2. public void OnClick(View _) {
  3. if(dialog != null) {
  4. dialog.show();
  5. return;
  6. }
  7. String[] menus = new String[]{"设置备注", "加入黑名单", "删除", "取消"};
  8. String[] colors = new String[]{"#111111", "#111111", "#111111", "#F24343"};
  9. dialog = BottomDialog.instance().showMenu(this, menus, colors, new BottomDialog.OnMenuItemClick() {
  10. @Override
  11. public void onItemClick(String[] menus, int position, String menu) {
  12. dialog.dismiss();
  13. Log.e(TAG, "" + Arrays.toString(menus) + " : " + position + " : " + menu);
  14. }
  15. });
  16. }