我的Android应用程序中有一个FloatingActionButton
。如果我点击这个按钮,我想得到一个带有滑块的OptionMenu
和里面的按钮。
这是我的代码:
@Override
public void onStart(){
super.onStart();
FloatingActionButton fab = (FloatingActionButton) getView().findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//Here I want to show a slider and a button. not a Snackbar
//Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
// .setAction("Action", null).show();
}
});
}
答案 0 :(得分:0)
试试这个
viewDidLoad
答案 1 :(得分:0)
我假设滑块是指滑块菜单,
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
drawer.openDrawer(GravityCompat.START);
}
//Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
// .setAction("Action", null).show();
}
});