• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps make my app support all screen size

oriz

Newbie
Hey i have tic tac toe game and it looks different on every device on my galaxy s3 its covers 3/4 of the screen and on galaxy s1 it covers the whole screen and in tablet it only covers like 1/4 of the screen i read android.developer tutorial but i didnt understood how do i make my app the same
In every screen size ( also get the images bigger)

please answer
 
Hi Oriz.

In your activity_main.xml (or whatever yours is called) then try adding these lines to your layout view:

android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitXY"

This works for image view, so I'm guessing it will work for the different layout views.
However, be aware that the different sprites should also be positioned depending on the size of the screen. Consider using a display matrix to grab screen dimensions to start with and position graphics accordingly.

Hope this helps.
 
Oops!
Sorry I meant Display Metrics!!! I'm getting tired now and will soon need my bed. See below:

DisplayMetrics dm;
dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int screenHeight=dm.heightPixels;
int screenWidth=dm.widthPixels;

Thanks.
 
Back
Top Bottom