Jump to content

Hi,

 

I need help to resize UI elements (Spinner and the orange icons) proportionally based on the screen size because the size of the UI elements are the same on both screens. Here's the code for resizing. I attached pictures of the 2 screens. I want the smaller phone to adjust the icons proportionally like the bigger tablet.

Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
final int width = size.x;
final int height = size.y;

int icon_dim_width = (int)PX_DP(height/10); //<- does not work

//I need a code here that will adjust the size based on the screen size.
float cheight = (0.75f * height) * 100;
float banner_height = height/5;

icon_bookmark.setMinimumWidth(icon_dim_width);
icon_bookmark.setMinimumWidth(icon_dim_width);
icon_bookmark.setMinimumHeight(icon_dim_width);
icon_bookmark.setMaxHeight(icon_dim_width);

icon_chapters.setMinimumWidth(icon_dim_width);
icon_chapters.setMinimumWidth(icon_dim_width);
icon_chapters.setMinimumHeight(icon_dim_width);
icon_chapters.setMaxHeight(icon_dim_width);

icon_exit.setMinimumWidth(icon_dim_width);
icon_exit.setMinimumWidth(icon_dim_width);
icon_exit.setMinimumHeight(icon_dim_width);
icon_exit.setMaxHeight(icon_dim_width);

DSC00002.JPG

DSC00003.JPG

DSC00004.JPG

My system: CPU: Intel i5 6500; Mobo: H110M-k; GPU: Nvidia GT 730; Memory: 16 GB; HDD: 2x 1TB HDD;

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×