I am attaching an imageview up on my frame layout. Here i want to get my imageview center co-ordinates. i will use that same co-ordinates to set my imageview in next layout.
if you wish to align a view at the center of other view then you can use this -
float center_x = parent_view.getX() + parent_view.getWidth()/2 - child_view.getWidth()/2;
and then obviously using -
child_view.setX(center_x);