I have seen bottom dialog can work without bottom behavior. then why it needs to be used as i have read many tutorial, its written, bottom dialog and bottom behavior are must for bottom sheet.
I am taking about model bottom sheet. please find the following code :
private void createDialog() {
if (dismissDialog()) {
return;
}
List<SampleModel> list = new ArrayList<>();
list.add(new SampleModel(R.string.share, R.mipmap.ic_launcher));
list.add(new SampleModel(R.string.upload, R.mipmap.ic_launcher));
list.add(new SampleModel(R.string.copy, R.mipmap.ic_launcher));
list.add(new SampleModel(R.string.print, R.mipmap.ic_launcher));
SampleSheetAdapter adapter = new SampleSheetAdapter(list);
adapter.setOnItemClickListener(new SampleSheetAdapter.OnItemClickListener() {
@Override
public void onItemClick(SampleSheetAdapter.ItemHolder item, int position) {
Toast.makeText(mContext,"clicked",Toast.LENGTH_LONG).show();
}
});
View view = getLayoutInflater().inflate(R.layout.sheet_main, null);
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.recyclerView);
recyclerView.setHasFixedSize(true);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
dialog = new BottomSheetDialog(this);
dialog.setContentView(view);
dialog.show();
}
the above code is working perfectly.