- How to Post Screen Shots to the Market
With your phone connected to your computer, and your application running,
run ddms.bat; this is found in your android sdk directory under the tools directory.
When ddms runs, you will see your phone ID and that it is "online". Click on it to select
your phone. From the Device menu, select Screen Capture. You will see your screen captured.
Click the save button to make a png file. At this point, the png file can be loaded into
the market for your application, however, it is currently sized at 480w x 854h. The market
supports this size and 320w x 480h. Resize you png down to 320w x 480h and post that to
the market. When your customers view screen shots in the market, the smaller size shows
your whole screen without any clipping. Using the larger size ends up clipping your screen!
- How to Create an APK for the Market
coming soon
- How to Layout Buttons using Gravity
One of the most used layouts is for buttons. Imagine a dialog box with OK and Cancel buttons on
it. Or something that has several buttons on it in a row. You want the buttons to be the same
size AND you want the buttons to take up the whole width of the screen. Here's how:
- Create a LinearLayout with orientation="horizontal" with the layout_width="fill_parent"
- Create Buttons inside this LinearLayout with layout_width="fill_parent" and layout_weight="1"
- If you want some space between each button, add layout_padding="10dip" to your LinearLayout

You would think that by setting a buttons width = "fill_parent" that the button would do
just that...fill in the parent so the next button won't be seen. However, using the
gravity setting tells the system the each button added gets the same amount of spacing from
the total width.
- How to Handle Portrait vs. Landscape Layouts
Many applications can take advantage of displaying their contents differently when the phone
is turned from a portrait layout to a landscape layout. If your application does not adjust when
someone rotates their phone, it can appear to be an incomplete or poorly designed product. In
order to build and test your application for both modes, design and layout for both aspects.
In your application directory structure, you will have res directory for your application resources.
Under this directory, with be a layout directory. This is where you define your screen layouts, for
example main.xml for your main screen, or help.xml for your help screen. To support horizontal or
landscape mode, create a new directory under the res directory and name it layout-land.
Now create your layouts in this directory so that they layout nicely in landscape mode. For our example,
we will have a main.xml in the layout directory and a main.xml in the layout-land directory.
When your application is run, the system will automatically read and display the proper main.xml depending
on the orientation of the phone. As the phone is rotated, the proper main.xml is loaded. Since you have
built two main.xml files, you can design, test, and see each layout in your Eclipse editor before you
deploy onto your phone.
|
|