【问题标题】:constraint layout issue after migrating to android x迁移到 android x 后的约束布局问题
【发布时间】:2019-12-09 14:30:49
【问题描述】:

大家好,在从兼容库迁移到 androidx 之后。

我遇到了与约束布局相关的问题,例如 custom:layout_constraintBottom_toTopOf="parent" 停止工作,我必须添加 custom:layout_constraintBottom_toBottomOf="parent"

编辑

这只是为了在迁移到androidx后分享我的信息。

【问题讨论】:

  • 请添加整个约束布局标签。所以我们可以指导您,您的目标 sdk 是什么?
  • 向我们展示 xml 代码以便我们提供帮助?

标签: android constraints android-constraintlayout androidx


【解决方案1】:

用这个替换你的约束标签。试试看。

<androidx.constraintlayout.widget.ConstraintLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >

像这样。

app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView"

【讨论】:

  • 迁移到 androidx ,通过使用 android studio 脚本来做到这一点。
  • 把你的布局代码放在这里,把自定义改成app
猜你喜欢
  • 1970-01-01
  • 2019-06-20
  • 1970-01-01
  • 2023-03-10
  • 1970-01-01
  • 2015-04-06
  • 2019-01-06
  • 1970-01-01
相关资源
最近更新 更多