Graphics Programs Reference
In-Depth Information
4. Finally, add these buttons to the layout and add the layout widget as
an additional content view using the addContentView method ( List-
ing 2-7 ) .
Listing 2-7. ADDCONTENTVIEW/src/com/apress/android/ad-
dcontentview/Main.java
layout.addView(buttonUp,
layoutParamsButtonUp);
layout.addView(buttonDown,
layoutParamsButtonDown);
layout.setGravity(Gravity.CENTER |
Gravity.RIGHT);
addContentView(layout, new
LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.MATCH_PARENT));
Using the addContentView method, visual elements like button-
views are easily separated from the OpenGL rendering ( Figure 2-11 ) .
This allows us to use OpenGL views along with XML-based layouts
and views to conveniently control the 3D rendering on OpenGL sur-
faces using the UI.
 
 
 
Search WWH ::




Custom Search