• support@answerspoint.com

Get screen dimensions in pixels

2431

I created some custom elements, and I want to programmatically place them to the upper right corner (n pixels from the top edge and m pixels from the right edge). Therefore I need to get the screen width and screen height and then set position:

int px = screenWidth - m;
int py = screenHeight - n;

How do I get screenWidth and screenHeight in the main Activity?

0Answer


Your Answer

    Facebook Share        
       
  • asked 8 years ago
  • viewed 2431 times
  • active 8 years ago

Best Rated Questions