androidscreencompatibility-mode

screen compatibility mode


I got so confused after reading the documentation. I've designed my app to run on small, normal and large screens. my question is: how to prevent my app from being stretched when running on tablets? on other words: I want

the system to draw the application's layout the same as it would on a normal size handset (emulating a 320dp x 480dp screen), with a black border that fills the remaining area of the screen.

as mentioned in the documentation. thank you.


Solution

  • You could possibly create a layout for xlarge screens which contains a RelativeLayout with a black background. In this RelativeLayout import your current layout (see the <include> tag), and position it in the location your require, also set the android:layout_width and android:layout_height in your include tag to 320dp and 480dp, this should force it to keep its size.

    I think this should roughly do what you need.