raq*_*zha 12 android android-constraintlayout constraint-layout-chains androidx
我在布局中使用的是androidx.constraintlayout.widget.ConstraintLayout,它没有显示链,也无法拖动任何小部件。我只是输入要使用的约束。
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="112dp"/>
Run Code Online (Sandbox Code Playgroud)
这是androidx约束布局的示例屏幕截图: androidx.constraintlayout.widget.ConstraintLayout
但是当我尝试切换回android.support.constraint.ConstraintLayout时,我可以看到它
<android.support.constraint.ConstraintLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="112dp"/>
Run Code Online (Sandbox Code Playgroud)
这是支持constraintLayout的示例屏幕截图: android.support.constraint.ConstraintLayout
这是错误还是什么?
我当前的解决方案是从:
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
Run Code Online (Sandbox Code Playgroud)
至
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
Run Code Online (Sandbox Code Playgroud)
但这不能解决我的问题,因为我不想使用支持。
Arv*_*kni 19
在我意识到应该使用Canary版本解决该问题之前,我遇到了同样的问题。在稳定版本旁边安装Canary版本之后,打开项目,现在您可以使用此实现:
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
Run Code Online (Sandbox Code Playgroud)
代替
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
Run Code Online (Sandbox Code Playgroud)
请记住,您可能需要执行以下操作:
我的问题用这种方法解决了。
小智 9
如果您使用的是最新的Android更新3.3.3,则从支持约束布局迁移到Android x:
<android.support.constraint.ConstraintLayout>
</android.support.constraint.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Run Code Online (Sandbox Code Playgroud)
为了得到这个也改变了gradle:
com.android.support.constraint:constraint-layout:1.1.3
Run Code Online (Sandbox Code Playgroud)
至
androidx.constraintlayout:constraintlayout:2.0.0-alpha3
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
16594 次 |
| 最近记录: |