-
Notifications
You must be signed in to change notification settings - Fork 192
Home
Aditya Sharat edited this page Feb 17, 2016
·
36 revisions
A LayoutBuilder
is used to build all the Views
in Proteus. To get an instance of a LayoutBuilder
create a new instance of LayoutBuilderFactory
. The factory returns singleton instances of different types LayoutBuilders.
LayoutBuilderFactory layoutBuilderFactory = new LayoutBuilderFactory();
- SimpleLayoutBuilder
- DataParsingLayoutBuilder
- DataAndViewParsinLayoutBuilder
LayoutBuilder builder;
builder = layoutBuilderFactory.getSimpleLayoutBuilder();
builder = layoutBuilderFactory.getDataParsingLayoutBuilder();
builder = layoutBuilderFactory.getDataAndViewParsingLayoutBuilder(Map<String, JsonObject> viewProvider);
ProteusView view = builder.build(parent, layout, data, styles -1);
-
parent The parent view whose
LayoutParams
theProteusView
will inherit. -
layout The
JsonObject
layout for the View. -
data The
JsonObject
data for Data Bindings. (null forSimpleLayoutBuilder
) -
childIndex The
Data Index
of the view. (-1 for none).
{
"type": "LinearLayout",
"layout_width": "match_parent",
"layout_height": "wrap_content",
"background": "#ffffff",
"orientation": "vertical",
"padding": "16dp",
"children": [
{
"type": "TextView",
"layout_width": "wrap_content",
"layout_height": "wrap_content",
"layout": "Hello World",
"textColor": "#444444"
}
]
}
{
"profile": {
"name" : "John Doe",
"level" : "9",
"credits" : 24031
}
}
Next: Layouts