Skip to content

Instantly share code, notes, and snippets.

@ameliacv
Created March 11, 2018 06:10
Show Gist options
  • Save ameliacv/93437b2a536ad6b856299638c6d71408 to your computer and use it in GitHub Desktop.
Save ameliacv/93437b2a536ad6b856299638c6d71408 to your computer and use it in GitHub Desktop.
@SuppressLint("ValidFragment")
public static class BottomDialogFragment extends BottomSheetDialogFragment {
public static BottomDialogFragment getInstance() {
return new BottomDialogFragment();
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.custom_bottom_sheet, container, false);
((TextView) view.findViewById(R.id.hello)).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// DO SOMETHING
}
});
return view;
}
}
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/hello"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/space_8"
android:text="Hello Click me!" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment