Android Programming Tutorials

(Romina) #1
A Few Good Resources

android:text="Notes:"
android:paddingLeft="2px"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<EditText android:id="@+id/notes"
android:singleLine="false"
android:gravity="top"
android:lines="3"
android:scrollHorizontally="false"
android:maxLines="3"
android:maxWidth="140sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<Button android:id="@+id/save"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Save"
/>
</LinearLayout>
</TableRow>
</TableLayout>
</FrameLayout>
</LinearLayout>
</TabHost>

In this revised layout, we:



  • Switched to four columns in our table, with columns #1 and #3 as
    stretchable

  • Put the name and address labels and fields on the same row

  • Put the type, notes, and Save button on the same row, with the


notes and Save button stacked via a LinearLayout



  • Made the notes three lines instead of two, since we have the room

  • Fixed the maximum width of the EditText widgets to 140 scaled


pixels (sp), so they do not automatically grow outlandishly large if
we type a lot


  • Added a bit of padding in places to make the placement of the
    labels and fields look a bit better


90
Free download pdf