Graphics Programs Reference
In-Depth Information
android:text="@string/down" />
</LinearLayout>
8. Add the inflated view (from 4) to the LinearLayout layout by
calling layout.addView(linearLayoutView) , then, add the
layout as an additional content view by calling: addCon-
tentView(layout, layoutParamsUpDown);
The purpose of using the layout from Listing 2-11 is to ensure:
Wide buttons are used : Buttons should have layout_width of
90dp (density independent pixels). Buttons should be at least that
wide, because graphics applications, such as games, require users
to interact continuously with UI elements, such as buttons, and,
they are easy to click if wide enough.
LinearLayout does not get hidden : Make sure the LinearLay-
out maintains a gap from the left corner of the screen and it has
layout_marginLeft and layout_marginBottom of
5dp .
Buttons have color contrast with other views : By setting a dark
background for LinearLayout using an-
droid:background="@android:drawable/
alert_dark_frame" , it becomes easy to spot light-colored
buttons, which helps quick interaction during gameplays. Use of
layouts with border or background is a great way to debug your
designs.
Be sure this activity takes the entire screen in landscape mode (as shown in Figure
2-13 ). Add the lines of code from Listing 2-3 to the activity element inside the
manifest file for this application.
 
Search WWH ::




Custom Search