出于某种原因,项目 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 的建议
相关分类