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). 我建立了一些自定義元素,我想以編程方式將它們放置在右上角(頂部邊緣n
像素,右側邊緣m
像素)。 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? 如何在主活動中獲取screenWidth
和screenHeight
? spa