Jun 20, 2011

How to create android applications for tablets?



With the new 2.3 SDK, we get the opportunity to develop android for tablets. (At least, with the Galaxy Tab Addon).

When starting a new tablet emulator, first we need to set the "Scale display to real size" option. This helps to set the tablet's size, to our screen size. In my case, it's 1440x900px.


lop android for tablets. (At least, with the Galaxy Tab Addon).

When starting a new tablet emulator, first we need to set the "Scale display to real size" option. This helps to set the tablet's size, to our screen size. In my case, it's 1440x900px.


If we run a simple 1.6 project (we need at least API level 4, SDK 1.6 for tablets) on a tablet emulator, we will get the following:


Our application doesn't fill the tablet's screen, we need to solve that!

First, open the AndroidManifest.xml file. Add this lines:

  1. <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="9"/>
  2. <supports-screens android:anyDensity="true" />

Now the application does fit the screen!


To develop apps for tablet and normal phones too, you need to create the 2 tablet resource folder under /res. Make drawable-large and layout-large folders, and put the tablet's graphics/ui there!
Of course, you need to create layout-large-land folder, for the tablet's landscape screen!



No comments:

Post a Comment