4
私はKotlinにTextView
のtextColor
をアニメーション化する:Kotlinでargb color int valueを使用できませんか?
val animator = ObjectAnimator.ofInt(myTextView, "textColor", 0xFF8363FF, 0xFFC953BE)
このエラーが発生します。
Error:(124, 43) None of the following functions can be called with the arguments supplied:
public open fun <T : Any!> ofInt(target: TextView!, xProperty: Property<TextView!, Int!>!, yProperty: Property<TextView!, Int!>!, path: Path!): ObjectAnimator! defined in android.animation.ObjectAnimator
public open fun <T : Any!> ofInt(target: TextView!, property: Property<TextView!, Int!>!, vararg values: Int): ObjectAnimator! defined in android.animation.ObjectAnimator
public open fun ofInt(target: Any!, propertyName: String!, vararg values: Int): ObjectAnimator! defined in android.animation.ObjectAnimator
public open fun ofInt(target: Any!, xPropertyName: String!, yPropertyName: String!, path: Path!): ObjectAnimator! defined in android.animation.ObjectAnimator
public open fun ofInt(vararg values: Int): ValueAnimator! defined in android.animation.ObjectAnimator
は、しかし、それはだ、値0xFF8363FF
と0xFFC953BE
はKotlinにInt
にキャストすることができないようですJavaのノーマル:
ObjectAnimator animator = ObjectAnimator.ofInt(myTextView, "textColor", 0xFF8363FF, 0xFFC953BE);
アイデア?前もって感謝します。
あなたはなぜそうなのかへの参照を追加することができます。Kotlinでは、のJavaには真実ではない負
Int
を示すために-
記号を追加する必要がありますか? – tynn@ tynn私がその点を説明することができたかどうかはわかりません。 –
それは、ありがとう、働く。 –