Recently, I created a class with my own version of a Toast. All working fine.
Now, I am trying to create a class with a version of a Snackbar and I have:
import android.support.design.widget.Snackbar;
public class Snack extends Snackbar{
}
Android Studio won't let me extend Snackbar, it displays the message:
"Cannot inherit from final 'android.support.design.widget.Snackbar'
Why does this happen? I did Google it a lot, but could not find answers.
Snackbar
is a final
class and you can't create a subclass of a final
class. for example, String
class in Java is also final and you can't derive any class from String
class.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句