1

i'm using the following code to position ImageView

    DisplayMetrics displayMetrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
    int height = displayMetrics.heightPixels;
    int width = displayMetrics.widthPixels;

    bg = (ImageView) rootView.findViewById(R.id.rectimage);
    bg.getLayoutParams().width = width;
    bg.getLayoutParams().height = 500;

    MarginLayoutParams params = (MarginLayoutParams)bg.getLayoutParams();
    params.setMargins(0, height - 510, 0, 0);

i want to place ImageView always at the bottom of screen but screenHeight - image_height is not working Any ideas?

sger
  • 719
  • 2
  • 12
  • 26

1 Answers1

1

Try to add

android:layout_alignParentBottom="true"

to your ImageView in your layout xml file

Krupa Patel
  • 3,309
  • 3
  • 23
  • 28