Android studio 4.0新建类不带public【解决方法】

今天爱分享给大家带来Android studio 4.0新建类不带public【解决方法】,希望能够帮助到大家。
默认的是这个样子的


#if (${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end

#if (${IMPORT_BLOCK} != "")${IMPORT_BLOCK}
#end
#parse("File Header.java")
#if (${VISIBILITY} == "PUBLIC")public #end #if (${ABSTRACT} == "TRUE")abstract #end #if (${FINAL} == "TRUE")final #end class ${NAME} #if (${SUPERCLASS} != "")extends ${SUPERCLASS} #end #if (${INTERFACES} != "")implements ${INTERFACES} #end {
}




修改成下面这样再新建类的时候就默认带public了


#if (${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
 
#if (${IMPORT_BLOCK} != "")${IMPORT_BLOCK}
#end
#parse("File Header.java")
#if (${VISIBILITY} == "public") public #end #if (${VISIBILITY} == "") public #end #if (${ABSTRACT} == "true")abstract #end #if (${FINAL} == "true")final #end class ${NAME} #if (${SUPERCLASS} != "")extends ${SUPERCLASS} #end #if (${INTERFACES} != "") implements ${INTERFACES} #end {
} 



其实语法是这样的


#if (${VISIBILITY} == "public") public #end #if (${VISIBILITY} == "") public #end 



解释 #if (${VISIBILITY} == “”) public #end 如果为”” 则为public 主要是这一句的作用 如果VISIBILITY =””的话则默认为public

人已赞赏
安卓

java.lang.IllegalargumentException:bad base--64【解决方法】

2020-12-23 14:12:42

安卓

Error: Cannot fit requested classes in a single dex file【解决方法】

2020-12-23 18:42:33

'); })();