1

我正在尝试使用 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 没有setHeightsetLayoutHeight也没有任何其他类似的方法。那么我怎样才能改变卡片的高度(和类似的属性)呢?

4

1 回答 1

-1

为 CardView 内的视图设置动画,而不是为 CardView 本身设置动画。

于 2014-11-20T13:35:35.977 回答