Step ZeroThis tutorial describes how to build a simple input form using DroidDraw and TableLayout. This tutorial assumes that you have downloaded and installed the Android SDK. This tutorial also assumes that you are reasonably familiar with concepts in GUI programming and the Java programming language.
Step OneStart up the DroidDraw User Interface Designer.
Step TwoSwitch the root layout to RelativeLayout
Step ThreeSelect the "Layouts" tab
Step FourDrag and drop a TableLayout object from the Layouts panel into the top-center of the screen
Step FiveDouble click on the TableLayout to modify its properties. Change its width to "fill_parent".
Step SixDrag and drop three TableRow objects from the Layouts panel into the TableLayout object. When you drop the TableRow objects, you should select TableLayout from the pop-up menu.
|
||
Step SevenDrag and drop a TextView into each of the table rows:
Step EightDouble-click on each TextView to edit its properties, change the text so that it matches the following image:
Step NineDrag and drop an EditText box into each table row to the right of the existing text.
Step TenSelect the TableLayout, modify the "Stretchable Column" property to have the value "1", this will stretch out all of the EditText widgets to fil the table. Note: selecting the layout can be difficult. To access stacked widgets which are "below" top level widgets, press the control key while you click (or right click) to select from the available widgets at that location.
Step ElevenEdit the properties of each EditText, make the text ""
|
||
Step TwelveDrag and drop a Button widget to the space just below the lower right corner of the TableLayout. It should be outside of the TableLayout and aligned with its right side.
Step ThirteenEdit the properties of this button to make the text "Ok"
Step FourteenPress "Generate" to generate the .xml file.
Step FifteenIn Eclipse, create a new Android project.
Step SixteenReplace the contents of res->layouts->main.xml with the xml generated in step twelve.
Step SeventeenRun your new project, you should see your GUI in Android. It should look something like:
Done! |