Tag: framelayout

如何在Kotlin中扩展android.widget.FrameLayout(RequiresApi 21,但是我需要使用minSdk 19)

我试图扩展在我的课kotlin android.widget.FrameLayout。 问题是,因为我升级到kotlin 1.2.21我无法编译,因为FrameLayout的最长(4参数)构造函数需要minSdk 21,但我的库也需要工作在api级别19。 我已经放弃了使用@JvmOverloads(它似乎是越野车和即时运行崩溃),所以我试图写“长”的代码。 就像是: 我尝试的第一种方法: class PullDownAnimationLayout : FrameLayout, Animator.AnimatorListener, PullDownAnimation { @RequiresApi(Build.VERSION_CODES.LOLLIPOP) constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0) constructor(context: Context) : this(context, null) override val MAX_PULL_HEIGHT_PX: […]