大家讲道理2017-04-17 17:07:18
直接用容器所在的Layout作为view就行了,例如:
public class SnackbarTestActivity extends Activity {
CoordinatorLayout container;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_snackbar_test);
container = (CoordinatorLayout) findViewById(R.id.container);
}
public void createSnackbar(View v) {
Snackbar.make(container, "SnackbarTest", Snackbar.LENGTH_LONG).show();
}
}