Code example for EditText

Methods: setGravitysetInputTypesetLinessetSingleLinesetText

0
        } 
        if (htmlWidget != null) {
            htmlWidget.loadData(getCurrentValue().get(0), "text/html", "UTF-8");
        } 
        if (editWidget != null) {
            editWidget.setText(getCurrentValue().get(0));
        } 
    } 
 
    @Override 
    public View buildView(LayoutContext context, LayoutMode mode, Document doc,
            List<String> attributeNames, WidgetDefinition widgetDef) {
 
        super.buildView(context, mode, doc, attributeNames, widgetDef);
 
        Context ctx = context.getActivity();
 
        if (mode == LayoutMode.VIEW) {
            container = new LinearLayout(ctx);
            container.setOrientation(LinearLayout.VERTICAL);
            applyBinding(); 
            return container;
        } else { 
            editWidget = new EditText(ctx);
            editWidget.setSingleLine(false);
            editWidget.setInputType(InputType.TYPE_CLASS_TEXT
                    | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
            editWidget.setLines(3);
            editWidget.setGravity(Gravity.TOP | Gravity.LEFT);
            applyBinding(); 
            return editWidget;
        } 
    }