Can't find android.support.design.widget.Snackbar in support design library

前端 未结 11 933
南方客
南方客 2021-02-02 05:31

I develop own library module where I use Snackbar.

Here is my Gradle file:

apply plugin: \'com.android.library\'

android {
    compileSdkV         


        
11条回答
  •  无人及你
    2021-02-02 06:18

    After upgrading to androidx it will show error.You have to import this library

    import com.google.android.material.snackbar.Snackbar;
    
     Snackbar snackbar = Snackbar.make(view, R.string.Mapview, Snackbar.LENGTH_INDEFINITE);
                View snackbarView = snackbar.getView();
                TextView textView = (TextView) snackbarView.findViewById(com.google.android.material.R.id.snackbar_text);
                textView.setMaxLines(5);
                snackbar.show();
    

    Hope it will solve your problem.

提交回复
热议问题