hcnak.blog

posted at 2015-09-04 17:52:47 +0000

Android Studio Fragment关于Avoid non-default constructors in fragments的错误

在android开发中,如果写了一个继承Fragment的类,那么在重载构造函数时,会提

Avoid non-default constructors in fragments: use a default constructor plus Fragment#setArguments(Bundle) instead的错误。

这时。需要在类的前面加上@SuppressLint("ValidFragment")才能解决错误。

SuppressLint说明

指示编译器(?)应忽略的注释元素(即@SuppressLint(“”))指定的警告。

官方文档:点击这里



© kanchzl AT kanchz DOT com

last updated on 2022-07-27 01:57:54 +0000