slidingDrawer克隆后改变layoutParams导致所有都变
slidingDrawer克隆后改变layoutParams的height导致所有slidingDrawer的height都发生改变,而将其getLayoutParams的结果也克隆后却抛出异常,请高手指教,谢谢!急用……
代码如下:
public class MySlidingDrawer extends SlidingDrawer implements Cloneable {
public MySlidingDrawer(Context context, AttributeSet attrs) {
super(context, attrs);
}
public Object clone(){
MySlidingDrawer mySD = null;
try {
mySD = (MySlidingDrawer) super.clone();
} catch (CloneNotSupportedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return mySD;
}
@Override
public LayoutParams getLayoutParams() {
LayoutParams layot = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
MyLayoutParams myLayoutParams = new MyLayoutParams(layot);
return (LayoutParams) myLayoutParams.clone();
}
}
public class MyLayoutParams extends LayoutParams implements Cloneable{
public MyLayoutParams(LayoutParams arg0) {
super(arg0);
// TODO Auto-generated constructor stub
}
public MyLayoutParams clone() {
try {
return (MyLayoutParams)super.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
}
return null;
}
}