I have been struggling with positioning views using the percent system, it appears to me that 100%x and 100%y are not actually the full width and height of the screen.
The attached images show a simple test app that has a main layout with a Tabhost and button and a Tab layout with a couple of buttons. The Tabhost is set to full screen width and height in the script:
The top left button is positioned as I would expect, right in the corner. However the bottom right buttons are not. The (grey) button on the main layout is close to the edges but not as close as the button in the top left (which is on the Tab layout). The real problem is the bottom right (green) button on the Tab layout, this is nowhere near the edge of the screen. The images below show the same app run on 2 different smartphones. They have different screen sizes (1920 x 1080 and 1280 x 720) but the same aspect ratio. One screen uses the Nexus style, on-screen controls, the other does not.
The 3 frames in each image show the result of changing the SetLeftAndRight and SetTopAndBottom values. I used 100/100%, 102/102% and 104/102% for the X & Y to try to get the button actually into the corner.
From this it would appear that the screen width is actually about 105% and height 102% or 104% depending on whether the on-screen control bar is shown or not.
Another point is that though all the buttons are 100 x 100 in the Designer, they come out at different sizes on screen. The one on the main layout (grey) is about 10% smaller than the ones on the TabHost (even when that is set to 100/100%).
The attached images show a simple test app that has a main layout with a Tabhost and button and a Tab layout with a couple of buttons. The Tabhost is set to full screen width and height in the script:
TabHost1.SetLeftAndRight(0,100%x)
TabHost1.SetTopAndBottom(0,100%y)
The buttons are all positioned in the top left or bottom right corners using anchors and edge distance of 1. The Tabhost padding is set to zero in the app:TabHost1.SetTopAndBottom(0,100%y)
TabManager.setTabHostPadding(TabHost1,0,0,0,0)
TabManager.setTabContentViewPadding(TabHost1,0,0,0,0)
TabManager.setTabContentViewPadding(TabHost1,0,0,0,0)
The top left button is positioned as I would expect, right in the corner. However the bottom right buttons are not. The (grey) button on the main layout is close to the edges but not as close as the button in the top left (which is on the Tab layout). The real problem is the bottom right (green) button on the Tab layout, this is nowhere near the edge of the screen. The images below show the same app run on 2 different smartphones. They have different screen sizes (1920 x 1080 and 1280 x 720) but the same aspect ratio. One screen uses the Nexus style, on-screen controls, the other does not.
The 3 frames in each image show the result of changing the SetLeftAndRight and SetTopAndBottom values. I used 100/100%, 102/102% and 104/102% for the X & Y to try to get the button actually into the corner.
From this it would appear that the screen width is actually about 105% and height 102% or 104% depending on whether the on-screen control bar is shown or not.
Another point is that though all the buttons are 100 x 100 in the Designer, they come out at different sizes on screen. The one on the main layout (grey) is about 10% smaller than the ones on the TabHost (even when that is set to 100/100%).