猿问

单击时展开/折叠不正确的 CardView

出于某种原因,项目 C CardView是唯一一个动画 - 即使在单击项目 B项目 A 时 CardView也是如此。在法国元音 CardView,因为它工作正常不适用。有谁知道如何解决这个问题,以便正确的 CardView 动画?

GridView 的 GridViewCustom 类


public class GridViewCustom extends GridView {

    public GridViewCustom(Context context) {

        super(context);

    }


    public GridViewCustom(Context context, AttributeSet attrs) {

        super(context, attrs);

    }


    public GridViewCustom(Context context, AttributeSet attrs, int defStyle) {

        super(context, attrs, defStyle);

    }


    @Override

    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

        int heightSpec;


        if (getLayoutParams().height == AbsListView.LayoutParams.WRAP_CONTENT) {

            heightSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);

        }

        else {

            //Any other height should be respected as is.

            heightSpec = heightMeasureSpec;

        }


        super.onMeasure(widthMeasureSpec, heightSpec);

    }

}

基于 Nikhil 的建议


http://img1.mukewang.com/6153fb7f00019f0f02690310.jpg

慕容708150
浏览 240回答 1
1回答
随时随地看视频慕课网APP

相关分类

Java
我要回答