// Retrieve the X coordinate of a TextView TextView myTextView = findViewById(R.id.my_text_view); float xCoordinate = myTextView.getX();
// Move an ImageView to a new X coordinate ImageView myImageView = findViewById(R.id.my_image_view); float newXCoordinate = 500f; myImageView.setX(newXCoordinate);This code sets the X coordinate of an ImageView with the ID "my_image_view" to 500f, which moves the view to the right by 500 pixels. Library/package: android.view