我是android的新手。我使用Spring Animation。 我希望图像缓慢下降
public void onAnimationStart(View view) {
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
width = size.x;
height = size.y;
float y = 0;
do {
view1.setTranslationY(y);
SpringAnimation animY = new SpringAnimation(view1,
DynamicAnimation.TRANSLATION_Y, 0);
//animY.setStartVelocity(10);
animY.getSpring().setStiffness(SpringForce.STIFFNESS_VERY_LOW);
animY.getSpring().setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY);
animY.start();
y+=1;
Log.d("TAG", "getTranslationX= " + String.valueOf(view1.getTranslationX()) + " getTranslationY = " + String.valueOf(view1.getTranslationY()));
} while (y < height);
答案 0 :(得分:0)
//This is just a regular POJO class.
class Employee {
int valA;
String valB, valC;
public Employee(int valA, String valB, String valC){
this.valA = valA;
this.valB = valB;
this.valC = valC;
}
public Employee(Employee e) {
this.valA = e.valA;
this.valB = e.valB;
this.valC = e.valC;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + valA;
result = prime * result + ((valB == null) ? 0 : valB.hashCode());
result = prime * result + ((valC == null) ? 0 : valC.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if(obj instanceof Employee && ((Employee)obj).hashCode() == this.hashCode()){
return true;
}
return false;
}
@Override
public String toString() {
return "Employee [valA=" + valA + ", valB=" + valB + ", valC=" + valC + "]";
}
}