Android開發零點起飛(第三章)筆記-android edittext phone number programmatically
Android開發零點起飛(第三章)筆記-android edittext phone number programmatically
TextView.setRawInputType()
TextView屬性和函數原廠對照表:http://developer.android.com/reference/android/widget/TextView.html#setRawInputType%28int%29
Attribute Name Related Method Description
android:autoLink setAutoLinkMask(int) Controls whether links such as urls and email addresses are automatically found and converted to clickable links.
android:autoText setKeyListener(KeyListener) If set, specifies that this TextView has a textual input method and automatically corrects some common spelling errors.
android:bufferType setText(CharSequence,TextView.BufferType) Determines the minimum type that getText() will return.
android:capitalize setKeyListener(KeyListener) If set, specifies that this TextView has a textual input method and should automatically capitalize what the user types.
android:cursorVisible setCursorVisible(boolean) Makes the cursor visible (the default) or invisible.
android:digits setKeyListener(KeyListener) If set, specifies that this TextView has a numeric input method and that these specific characters are the ones that it will accept.
android:drawableBottom setCompoundDrawablesWithIntrinsicBounds(int,int,int,int) The drawable to be drawn below the text.
android:drawableEnd setCompoundDrawablesRelativeWithIntrinsicBounds(int,int,int,int) The drawable to be drawn to the end of the text.
android:drawableLeft setCompoundDrawablesWithIntrinsicBounds(int,int,int,int) The drawable to be drawn to the left of the text.
android:drawablePadding setCompoundDrawablePadding(int) The padding between the drawables and the text.
android:drawableRight setCompoundDrawablesWithIntrinsicBounds(int,int,int,int) The drawable to be drawn to the right of the text.
android:drawableStart setCompoundDrawablesRelativeWithIntrinsicBounds(int,int,int,int) The drawable to be drawn to the start of the text.
android:drawableTop setCompoundDrawablesWithIntrinsicBounds(int,int,int,int) The drawable to be drawn above the text.
android:editable If set, specifies that this TextView has an input method.
android:editorExtras setInputExtras(int) Reference to an <input-extras> XML resource containing additional data to supply to an input method, which is private to the implementation of the input method.
android:elegantTextHeight setElegantTextHeight(boolean) Elegant text height, especially for less compacted complex script text.
android:ellipsize setEllipsize(TextUtils.TruncateAt) If set, causes words that are longer than the view is wide to be ellipsized instead of broken in the middle.
android:ems setEms(int) Makes the TextView be exactly this many ems wide.
android:fontFamily setTypeface(Typeface) Font family (named by string) for the text.
android:fontFeatureSettings setFontFeatureSettings(String) Font feature settings.
android:freezesText setFreezesText(boolean) If set, the text view will include its current complete text inside of its frozen icicle in addition to meta-data such as the current cursor position.
android:gravity setGravity(int) Specifies how to align the text by the view’s x- and/or y-axis when the text is smaller than the view.
android:height setHeight(int) Makes the TextView be exactly this many pixels tall.
android:hint setHint(int) Hint text to display when the text is empty.
android:imeActionId setImeActionLabel(CharSequence,int) Supply a value for EditorInfo.actionId used when an input method is connected to the text view.
android:imeActionLabel setImeActionLabel(CharSequence,int) Supply a value for EditorInfo.actionLabel used when an input method is connected to the text view.
android:imeOptions setImeOptions(int) Additional features you can enable in an IME associated with an editor to improve the integration with your application.
android:includeFontPadding setIncludeFontPadding(boolean) Leave enough room for ascenders and descenders instead of using the font ascent and descent strictly.
android:inputMethod setKeyListener(KeyListener) If set, specifies that this TextView should use the specified input method (specified by fully-qualified class name).
android:inputType setRawInputType(int) The type of data being placed in a text field, used to help an input method decide how to let the user enter text.
android:letterSpacing setLetterSpacing(float) Text letter-spacing.
android:lineSpacingExtra setLineSpacing(float,float) Extra spacing between lines of text.
android:lineSpacingMultiplier setLineSpacing(float,float) Extra spacing between lines of text, as a multiplier.
android:lines setLines(int) Makes the TextView be exactly this many lines tall.
android:linksClickable setLinksClickable(boolean) If set to false, keeps the movement method from being set to the link movement method even if autoLink causes links to be found.
android:marqueeRepeatLimit setMarqueeRepeatLimit(int) The number of times to repeat the marquee animation.
android:maxEms setMaxEms(int) Makes the TextView be at most this many ems wide.
android:maxHeight setMaxHeight(int) Makes the TextView be at most this many pixels tall.
android:maxLength setFilters(InputFilter) Set an input filter to constrain the text length to the specified number.
android:maxLines setMaxLines(int) Makes the TextView be at most this many lines tall.
android:maxWidth setMaxWidth(int) Makes the TextView be at most this many pixels wide.
android:minEms setMinEms(int) Makes the TextView be at least this many ems wide.
android:minHeight setMinHeight(int) Makes the TextView be at least this many pixels tall.
android:minLines setMinLines(int) Makes the TextView be at least this many lines tall.
android:minWidth setMinWidth(int) Makes the TextView be at least this many pixels wide.
android:numeric setKeyListener(KeyListener) If set, specifies that this TextView has a numeric input method.
android:password setTransformationMethod(TransformationMethod) Whether the characters of the field are displayed as password dots instead of themselves.
android:phoneNumber setKeyListener(KeyListener) If set, specifies that this TextView has a phone number input method.
android:privateImeOptions setPrivateImeOptions(String) An addition content type description to supply to the input method attached to the text view, which is private to the implementation of the input method.
android:scrollHorizontally setHorizontallyScrolling(boolean) Whether the text is allowed to be wider than the view (and therefore can be scrolled horizontally).
android:selectAllOnFocus setSelectAllOnFocus(boolean) If the text is selectable, select it all when the view takes focus.
android:shadowColor setShadowLayer(float,float,float,int) Place a blurred shadow of text underneath the text, drawn with the specified color.
android:shadowDx setShadowLayer(float,float,float,int) Horizontal offset of the text shadow.
android:shadowDy setShadowLayer(float,float,float,int) Vertical offset of the text shadow.
android:shadowRadius setShadowLayer(float,float,float,int) Blur radius of the text shadow.
android:singleLine setTransformationMethod(TransformationMethod) Constrains the text to a single horizontally scrolling line instead of letting it wrap onto multiple lines, and advances focus instead of inserting a newline when you press the enter key.
android:text setText(CharSequence,TextView.BufferType) Text to display.
android:textAllCaps setAllCaps(boolean) Present the text in ALL CAPS.
android:textAppearance Base text color, typeface, size, and style.
android:textColor setTextColor(int) Text color.
android:textColorHighlight setHighlightColor(int) Color of the text selection highlight.
android:textColorHint setHintTextColor(int) Color of the hint text.
android:textColorLink setLinkTextColor(int) Text color for links.
android:textIsSelectable isTextSelectable() Indicates that the content of a non-editable text can be selected.
android:textScaleX setTextScaleX(float) Sets the horizontal scaling factor for the text.
android:textSize setTextSize(int,float) Size of the text.
android:textStyle setTypeface(Typeface) Style (bold, italic, bolditalic) for the text.
android:typeface setTypeface(Typeface) Typeface (normal, sans, serif, monospace) for the text.
android:width setWidth(int) Makes the TextView be exactly this many pixels wide.
[Collapse]
Inherited XML Attributes
From class android.view.View
Attribute Name Related Method Description
android:accessibilityLiveRegion setAccessibilityLiveRegion(int) Indicates to accessibility services whether the user should be notified when this view changes.
android:alpha setAlpha(float) alpha property of the view, as a value between 0 (completely transparent) and 1 (completely opaque).
android:background setBackgroundResource(int) A drawable to use as the background.
android:backgroundTint setBackgroundTintList(ColorStateList) Tint to apply to the background.
android:backgroundTintMode setBackgroundTintMode(PorterDuff.Mode) Blending mode used to apply the background tint.
android:clickable setClickable(boolean) Defines whether this view reacts to click events.
android:contentDescription setContentDescription(CharSequence) Defines text that briefly describes content of the view.
android:drawingCacheQuality setDrawingCacheQuality(int) Defines the quality of translucent drawing caches.
android:duplicateParentState When this attribute is set to true, the view gets its drawable state (focused, pressed, etc.) from its direct parent rather than from itself.
android:elevation setElevation(float) base z depth of the view
Must be a dimension value, which is a floating point number appended with a unit such as “14.5sp”.
android:fadeScrollbars setScrollbarFadingEnabled(boolean) Defines whether to fade out scrollbars when they are not in use.
android:fadingEdgeLength getVerticalFadingEdgeLength() Defines the length of the fading edges.
android:filterTouchesWhenObscured setFilterTouchesWhenObscured(boolean) Specifies whether to filter touches when the view’s window is obscured by another visible window.
android:fitsSystemWindows setFitsSystemWindows(boolean) Boolean internal attribute to adjust view layout based on system windows such as the status bar.
android:focusable setFocusable(boolean) Boolean that controls whethe
r a view can take focus.
android:focusableInTouchMode setFocusableInTouchMode(boolean) Boolean that controls whether a view can take focus while in touch mode.
android:hapticFeedbackEnabled setHapticFeedbackEnabled(boolean) Boolean that controls whether a view should have haptic feedback enabled for events such as long presses.
android:id setId(int) Supply an identifier name for this view, to later retrieve it with View.findViewById() or Activity.findViewById().
android:importantForAccessibility setImportantForAccessibility(int) Controls how this View is important for accessibility which is if it fires accessibility events and if it is reported to accessibility services that query the screen.
android:isScrollContainer setScrollContainer(boolean) Set this if the view will serve as a scrolling container, meaing that it can be resized to shrink its overall window so that there will be space for an input method.
android:keepScreenOn setKeepScreenOn(boolean) Controls whether the view’s window should keep the screen on while visible.
android:layerType setLayerType(int,Paint) Specifies the type of layer backing this view.
android:layoutDirection setLayoutDirection(int) Defines the direction of layout drawing.
android:longClickable setLongClickable(boolean) Defines whether this view reacts to long click events.
android:minHeight setMinimumHeight(int) Defines the minimum height of the view.
android:minWidth setMinimumWidth(int) Defines the minimum width of the view.
android:nextFocusDown setNextFocusDownId(int) Defines the next view to give focus to when the next focus is FOCUS_DOWN If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a RuntimeException will result when the reference is accessed.
android:nextFocusForward setNextFocusForwardId(int) Defines the next view to give focus to when the next focus is FOCUS_FORWARD If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a RuntimeException will result when the reference is accessed.
android:nextFocusLeft setNextFocusLeftId(int) Defines the next view to give focus to when the next focus is FOCUS_LEFT.
android:nextFocusRight setNextFocusRightId(int) Defines the next view to give focus to when the next focus is FOCUS_RIGHT If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a RuntimeException will result when the reference is accessed.
android:nextFocusUp setNextFocusUpId(int) Defines the next view to give focus to when the next focus is FOCUS_UP If the reference refers to a view that does not exist or is part of a hierarchy that is invisible, a RuntimeException will result when the reference is accessed.
android:onClick Name of the method in this View’s context to invoke when the view is clicked.
android:padding setPaddingRelative(int,int,int,int) Sets the padding, in pixels, of all four edges.
android:paddingBottom setPaddingRelative(int,int,int,int) Sets the padding, in pixels, of the bottom edge; see padding.
android:paddingEnd setPaddingRelative(int,int,int,int) Sets the padding, in pixels, of the end edge; see padding.
android:paddingLeft setPadding(int,int,int,int) Sets the padding, in pixels, of the left edge; see padding.
android:paddingRight setPadding(int,int,int,int) Sets the padding, in pixels, of the right edge; see padding.
android:paddingStart setPaddingRelative(int,int,int,int) Sets the padding, in pixels, of the start edge; see padding.
android:paddingTop setPaddingRelative(int,int,int,int) Sets the padding, in pixels, of the top edge; see padding.
android:requiresFadingEdge setVerticalFadingEdgeEnabled(boolean) Defines which edges should be faded on scrolling.
android:rotation setRotation(float) rotation of the view, in degrees.
android:rotationX setRotationX(float) rotation of the view around the x axis, in degrees.
android:rotationY setRotationY(float) rotation of the view around the y axis, in degrees.
android:saveEnabled setSaveEnabled(boolean) If unset, no state will be saved for this view when it is being frozen.
android:scaleX setScaleX(float) scale of the view in the x direction.
android:scaleY setScaleY(float) scale of the view in the y direction.
android:scrollX The initial horizontal scroll offset, in pixels.
android:scrollY The initial vertical scroll offset, in pixels.
android:scrollbarAlwaysDrawHorizontalTrack Defines whether the horizontal scrollbar track should always be drawn.
android:scrollbarAlwaysDrawVerticalTrack Defines whether the vertical scrollbar track should always be drawn.
android:scrollbarDefaultDelayBeforeFade setScrollBarDefaultDelayBeforeFade(int) Defines the delay in milliseconds that a scrollbar waits before fade out.
android:scrollbarFadeDuration setScrollBarFadeDuration(int) Defines the delay in milliseconds that a scrollbar takes to fade out.
android:scrollbarSize setScrollBarSize(int) Sets the width of vertical scrollbars and height of horizontal scrollbars.
android:scrollbarStyle setScrollBarStyle(int) Controls the scrollbar style and position.
android:scrollbarThumbHorizontal Defines the horizontal scrollbar thumb drawable.
android:scrollbarThumbVertical Defines the vertical scrollbar thumb drawable.
android:scrollbarTrackHorizontal Defines the horizontal scrollbar track drawable.
android:scrollbarTrackVertical Defines the vertical scrollbar track drawable.
android:scrollbars Defines which scrollbars should be displayed on scrolling or not.
android:soundEffectsEnabled setSoundEffectsEnabled(boolean) Boolean that controls whether a view should have sound effects enabled for events such as clicking and touching.
android:stateListAnimator Sets the state-based animator for the View.
android:tag Supply a tag for this view containing a String, to be retrieved later with View.getTag() or searched for with View.findViewWithTag().
android:textAlignment setTextAlignment(int) Defines the alignment of the text.
android:textDirection setTextDirection(int) Defines the direction of the text.
android:transformPivotX setPivotX(float) x location of the pivot point around which the view will rotate and scale.
android:transformPivotY setPivotY(float) y location of the pivot point around which the view will rotate and scale.
android:transitionName Names a View such that it can be identified for Transitions.
android:translationX setTranslationX(float) translation in x of the view.
android:translationY setTranslationY(float) translation in y of the view.
android:translationZ setTranslationZ(float) translation in z of the view.
android:visibility setVisibility(int) Controls the initial visibility of the view.