Reputation: 740
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?
Upvotes: 1
Views: 116
Reputation: 3359
Try to add
android:layout_alignParentBottom="true"
to your ImageView in your layout xml file
Upvotes: 1