android - 无法为新的 MotionLayout 声明 MotionScene
问题描述
我想试试新的 MotionLayot。但我无法加载 MotionScreen。
我已将此依赖项添加到 gradle:
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha1'
implementation 'com.android.support:design:27.1.1'
并且能够在 xml 文件中声明运动布局:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.motion.MotionLayout 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"
tools:context=".MainActivity">
<ImageView
android:id="@+id/movingCircle"
android:src="@drawable/ic_circle"
android:layout_width="40dp"
android:layout_height="40dp" />
</android.support.constraint.motion.MotionLayout>
但是当我试图在 xml 文件夹中添加一个新场景时,它不会弹出也不会点击到源。
<?xml version="1.0" encoding="utf-8"?>
<MotionScene //does not popup as a hint. Seems like
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:motion="http://schemas.android.com/apk/res-auto">
</MotionScene>
我做错了什么?谢谢你。
解决方案
检查您的gradle.properties
文件并删除此行
android.useAndroidX=true
android.enableJetifier=true
因为constraint-layout:2.0.0
仅适用于经典支持包
推荐阅读
- python - 如何通过 USB 连接和 python 查找和访问微芯片
- javascript - 日期时间选择器引导 Tempus Dominus
- java - Java SDK v3:直接连接模式出现异常
- powershell - 运行两个python文件的powershell脚本循环
- java - 如何在 Spring 的 WebClient 上验证 bean?
- python - 将具有可为空整数数据类型的 pandas DataFrame 保存到 HDF 文件(格式='table')
- elasticsearch - 如何提升与最佳结果相似的替代方案
- mysql - 如何在 MySQL 中为 SET 类型设置超过 1 个默认值?
- blazor - Mat Blazor mat-expansion-panel 移除高程/边框
- ruby - 对使用 reduce 及其实际尝试做的事情感到困惑