我通常在xml中设置drawable as android:icon="@drawable/my_icon"
但是在某些项目中我看到了代码android:icon="?my_icon".
android:icon="@drawable/my_icon"和之间有什么区别android:icon="?my_icon"?
我在类中有一个扩展函数
class Utils{
private var x : Int = 0;
public fun Utils.multiply() : Int{
return this.x*100;
}
}
Run Code Online (Sandbox Code Playgroud)
为什么我可以在另一个扩展中使用扩展乘法
fun Utils.add() : Int{
return this.multiply()+100
}
Run Code Online (Sandbox Code Playgroud)
但不能在Main类中使用
class Main{
val utils = Utils()
val multi = utils.multiply() //error : Unresolved reference
}
Run Code Online (Sandbox Code Playgroud)