我一直试图在两个片段之间设置过渡动画。我最初在xml中放置了一个属性动画(并没有真正起作用),然后将其更改为objectAnimator。由于某些原因,Android Studio无法识别objectAnimator标记。
这是我的AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nick.randomapplication" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.Base.AppCompat.Light" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
我的build.Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.nick.randomapplication"
minSdkVersion 19
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:20.0.+"
}
和xml文件:
<?xml version="1.0" encoding="utf-8"?>
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android">
</objectAnimator>
感谢您抽出宝贵时间来看看这个。我不知道该怎么做。
答案 0 :(得分:39)
我认为您已将xml文件放在错误的文件夹中。
THREE.Line
valueAnimator
和objectAnimator
资源
应该在 res / animator 文件夹中,而不是在 res / anim 中。
请访问android开发者以获取更多信息。 http://developer.android.com/guide/topics/resources/animation-resource.html