Creating a Template

Overview

In this section, you create a circular layout for your QCircle app. First, create a QCircleTemplate instance. You can select a layout type from among an empty layout, a layout with a sub-area or a layout with two sub-areas.

The following code is for creating the content with a horizontal sub-area.

QCircleTemplate template = new QCircleTemplate(
                          this,
                          TemplateType.CIRCLE_HORIZONTAL
                          );

 

The first parameter is for the Activity to apply this layout, and the second parameter refers to the content with a horizontal sub-area. If there is no second parameter, the QCircleTemplate applies an empty content circle layout as the default.

Layout types are defined in the TemplateType class. The following table shows the layouts for constants for each type.

 

Constants

Circle Layout

TemplateType.CIRCLE_EMPTY

Empty content

TemplateType.CIRCLE_HORIZONTAL

Content with a horizontal sub-area

TemplateType.CIRCLE_VERTICAL

Content with a vertical sub-area

TemplateType.CIRCLE_COMPLEX

Content with two sub-areas on top

TemplateType.CIRCLE_SIDEBAR

Content with two sub-areas on side

 

In order to apply template, use setContentView() in Android Activity. getView() is provided in QCircleTemplate class to get the view of the created template.

Add the following line in the activity:

setContentView(Template.getView());

 

Example

QCircleTemplate template = new QCircleTemplate(
              this, TemplateType.CIRCLE_COMPLEX);

              setContentView(template.getView());

 

mobile_qcircle_develop_app_key1.png

 

Template Layouts

LG QCircle APIs define five types of templates. Templates are loaded by a tag in TemplateType class.

 

CIRCLE_EMPTY

CIRCLE_EMPTY is an empty relative layout in a circular shape. CIRCLE_EMPTY template is a view group that includes any views in a relative position. Child views specify their position within the circular shape to be shown appropriately through the Quick Circle window.

mobile_qcircle_develop_app_key_1.png

 

CIRCLE_HORIZONTAL

CIRCLE_HORIZONTAL is a relative layout consisting of a horizontal sub-area and the main area. The sub- and main area are also relative layouts and the height of the horizontal sub-area is resizable. Since both areas are also relative layouts, each of them is a view group that displays child views.

mobile_qcircle_develop_app_key_2.png

 

CIRCLE_VERTICAL

CIRCLE_VERTICAL is a relative layout consisting of a vertical sub-area and the main area. The sub- and main area are also relative layouts and the width of the vertical sub-area is resizable. Since each areas are also relative layouts, each of them is a view group that displays child views.

mobile_qcircle_develop_app_key_3.png

 

CIRCLE_COMPLEX

CIRCLE_COMPLEX is a relative layout consists of two top areas and the main area. The height of the sub area is resizable. However, the width of each sub area is not resizable and always uses the same amount of portion. All areas are relative layouts so that each of them is a view group that displays child views.

mobile_qcircle_develop_app_key_4.png

 

CIRCLE_SIDEBAR

CIRCLE_SIDEBAR is a relative layout consisting of two sub-areas on each side. The width of each sub-area is resizable. All areas are relative layouts so that each of them is a view group that displays child views.

mobile_qcircle_develop_app_key_5.png

Navigation