I want to animate a relative layout along the y-axis so I want to get its position on the y-axis. I tried many things like:
getY()
getTop()
getScreenLocation()
and so on, but everything is returning 0.
How can I find the position?
following is the code
ImageView advancetab = (ImageView) findViewById(R.id.imageView4);
RelativeLayout advancelayout = (RelativeLayout) findViewById(R.id.relativeLayout2);
final ObjectAnimator anim = ObjectAnimator.ofFloat(advancelayout, "Y",
advancelayout.getY(),advancelayout.getY()-100);
anim.setDuration(1000);
advancetab.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
anim.start();
}
});
When i clicked on the image then layout animate from 0,0 position to up.