|
AI2 Component
(Version nb184)
|
Go to the documentation of this file.
7 package com.google.appinventor.components.runtime;
23 import android.graphics.drawable.Drawable;
24 import android.os.Build;
25 import android.view.View;
26 import android.view.View.OnFocusChangeListener;
27 import android.widget.EditText;
38 implements OnFocusChangeListener {
40 protected final EditText
view;
43 private int textAlignment;
46 private int backgroundColor;
49 private int fontTypeface;
55 private boolean italic;
61 private int textColor;
64 private Drawable defaultTextBoxDrawable;
80 if (Build.VERSION.SDK_INT >= 24 ) {
85 view.setOnFocusChangeListener(
this);
87 defaultTextBoxDrawable =
view.getBackground();
126 @
SimpleEvent(description =
"Event raised when the %type% is selected for input, such as by "
127 +
"the user touching it.")
136 @
SimpleEvent(description =
"Event raised when the %type% is no longer selected for input, such "
137 +
"as if the user touches a different text box.")
163 description =
"Whether the text should be left justified, centered, " +
164 "or right justified. By default, text is left justified.",
167 return textAlignment;
185 this.textAlignment = alignment;
197 description =
"The background color of the input box. You can choose " +
198 "a color by name in the Designer or in the Blocks Editor. The " +
199 "default background color is 'default' (shaded 3-D look).")
202 return backgroundColor;
219 backgroundColor = argb;
234 description =
"Whether the user can enter text into the %type%. " +
235 "By default, this is true.")
249 defaultValue =
"True")
265 description =
"Whether the font for the text should be bold. By " +
266 "default, it is not.")
278 defaultValue =
"False")
295 description =
"Whether the text should appear in italics. By " +
296 "default, it does not.",
309 defaultValue =
"False")
312 this.italic = italic;
323 description =
"The font size for the text. By default, it is " +
352 description =
"The font for the text. The value can be changed in " +
373 fontTypeface = typeface;
384 description =
"Text that should appear faintly in the %type% to " +
385 "provide a hint as to what the user should enter. This can only be " +
386 "seen if the Text property is empty.")
402 public void Hint(String hint) {
429 description =
"The text in the %type%, which can be set by the " +
430 "programmer in the Designer or Blocks Editor, or it can be entered by " +
431 "the user (unless the <code>Enabled</code> property is false).")
432 public
void Text(String text) {
444 description =
"The color for the text. You can choose a color by name " +
445 "in the Designer or in the Blocks Editor. The default text color is " +
474 description =
"Sets the %type% active.")
void Enabled(boolean enabled)
static void setText(TextView textview, String text)
TextBoxBase(ComponentContainer container, EditText textview)
static final String PROPERTY_TYPE_TEXTALIGNMENT
static final int COLOR_DEFAULT
static final String PROPERTY_TYPE_TYPEFACE
static void disableSuggestions(EditText textview)
-*- mode: java; c-basic-offset: 2; -*-
static final String PROPERTY_TYPE_STRING
void setChildWidth(AndroidViewComponent component, int width)
static final String PROPERTY_TYPE_BOOLEAN
static void setFontTypeface(TextView textview, int typeface, boolean bold, boolean italic)
static String getText(TextView textview)
void $add(AndroidViewComponent component)
static void setAlignment(TextView textview, int alignment, boolean centerVertically)
void BackgroundColor(int argb)
static float getFontSize(TextView textview, Context context)
static final String PROPERTY_TYPE_TEXTAREA
static final String DEFAULT_VALUE_COLOR_DEFAULT
static boolean dispatchEvent(Component component, String eventName, Object...args)
static void setBackgroundColor(TextView textview, int argb)
static final int TEXTBOX_PREFERRED_WIDTH
static void setFontSize(TextView textview, float size)
static void setBackgroundDrawable(View view, Drawable drawable)
static final int COLOR_BLACK
void FontSize(float size)
Copyright 2009-2011 Google, All Rights reserved.
static boolean isEnabled(TextView textview)
static final int ALIGNMENT_NORMAL
static final int TYPEFACE_DEFAULT
static final String PROPERTY_TYPE_COLOR
static final int COLOR_WHITE
final ComponentContainer container
static final String PROPERTY_TYPE_NON_NEGATIVE_FLOAT
static void setEnabled(TextView textview, boolean enabled)
void onFocusChange(View previouslyFocused, boolean gainFocus)
static void setTextColor(TextView textview, int argb)
static final float FONT_DEFAULT_SIZE
static final String DEFAULT_VALUE_COLOR_BLACK