Skip to content

Instantly share code, notes, and snippets.

@Velmm
Last active December 29, 2017 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Velmm/da520e49b470f4fe8b7ec3c2831bcd16 to your computer and use it in GitHub Desktop.
Save Velmm/da520e49b470f4fe8b7ec3c2831bcd16 to your computer and use it in GitHub Desktop.
public class MainActivity extends AppCompatActivity implements Callbacks{
private CoordinatorLayout coordinatorLayout;
private BottomSheetBehavior behavior;
private View persistentbottomSheet;
private TextView cart;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
coordinatorLayout = (CoordinatorLayout)findViewById(R.id.coordinator);
persistentbottomSheet = coordinatorLayout.findViewById(R.id.bottomsheet);
bottomSheetRecyclerview = coordinatorLayout.findViewById(R.id.recyclerview_bottom_sheet);
BottomSheetBehavior behavior = BottomSheetBehavior.from(persistentbottomSheet);
}
public void ExpandBottomSheet(View view){
if (behavior.getState() == BottomSheetBehavior.STATE_COLLAPSED) {
behavior.setState(BottomSheetBehavior.STATE_EXPANDED);
} else {
behavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment