I created a imageView
via code and would like to know how to center it on the screen
I created a imageView
via code and would like to know how to center it on the screen
Hello,
This will depend on the type of layout you are using. But try using this:
LinearLayout.LayoutParams mLayoutParams=new LinearLayout.LayoutParams(width, height);
mLayoutParams.gravity=Gravity.CENTER;
ImageView.setLayoutParams(layoutParams);