lon*_*ngi 1 android-fragments kotlin android-annotations
我如何使用@FragmentArg从AndroidAnnotations内Kotlin片段?
@EFragment(R.layout.debug_empty_fragment)
open class EmptyFragment : Fragment(){
@FragmentArg("debugIndex")
var debugIndex:Int = 0
}
Run Code Online (Sandbox Code Playgroud)
这给了我以下gradle错误:
error: org.androidannotations.annotations.FragmentArg cannot be used on a private element
Run Code Online (Sandbox Code Playgroud)
我试图使debugIndex open (公共),但它不起作用。有任何想法吗?这有可能吗?
我正在使用Android Annotations 4.3.1和kotlin 1.1.2-5
好吧,@JvmField是你的朋友。(更多信息)
指示Kotlin编译器不要为此属性生成getter / setter,并将其公开为字段。
所以@FragmentArg应该看起来像这样
@JvmField
@FragmentArg("debugIndex")
var debugIndex:Int = 0
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
462 次 |
| 最近记录: |