我正在尝试使用 objectanimator 来做到这一点,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" >
<objectAnimator
android:duration="@android:integer/config_shortAnimTime"
android:propertyName="layout_height"
android:valueTo="300dp"
android:valueType="floatType" />
</item>
<item android:state_focused="false">
<objectAnimator
android:duration="@android:integer/config_shortAnimTime"
android:propertyName="layout_height"
android:valueTo="100dp"
android:valueType="floatType" />
</item>
</selector>
但是,它不起作用,因为据我所知 Cardviews 没有setHeight
,setLayoutHeight
也没有任何其他类似的方法。那么我怎样才能改变卡片的高度(和类似的属性)呢?