最近新学习了一个可折叠控件,在控件中可添加布局;
ExpandView.java
public class ExpandView extends FrameLayout implements View.OnClickListener {
private Animation mExpandAnimation;
private Animation mCollapseAnimation;
private boolean mIsExpand;
private int layoutId;
public ExpandView(Context context) {
this(context, null);
}
public ExpandView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public ExpandView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public void setLayout(int layout) {
this.layoutId = layout;
initExpandView();
}
private void initExpandView() {
LayoutInflater.from(getContext()).inflate(layoutId, this, true);
// mExpandAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.expand);
mExpandAnimation = AnimationUtils.loadAnimation(getContext(), R.anim.fade_appear);
mExpandAnim

最低0.47元/天 解锁文章
977





