Android Studio Text组件介绍
Text组件
1.1Text组件有那些
:
以上就是常见的text组件
别看这么多,其实大体上仅需分为6种:
TextView
EditText
AutoCompleteTextView
MultiAutoCompleteTextView
CheckedTextView
android.support.design.widget.TextInputXXX。
稍微介绍一下
- TextView仅是展示文本,可以通过代码去改变,相当于Lable
- Pain Text可以输入文本
- Password输入文本后以*显示
- Password(numeric)仅能输入数字的password
- E-mail 输入邮箱(不用说)
- Phone 输入电话号码(不用说)
- Postal Address邮寄地址
- Time填写时间
- Date填写日期
- Number 输入数字,会自动弹出只能输入Number的键盘
- Number (single)只能输入单独的数字
- Number(deicimal)可以输入带小数的数字
- CheckedTextView实现打勾的checked效果的一个控件,它就是CheckedTextView控件,相当于完成一个任务就打钩
- AutoCompleteText会自动帮你补全文本-
- MultiAutoCompleteTextView通过分词器Tokenizer,可以支持连续提示。即第一次点击提示信息后,会自动在后面添加分隔符(默认为逗号,并加上空格),然后又可以继续显示提示信息
如何使用?上代码!
<>1,Textview
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<>2,EditText
<EditText
android:id="@+id/editText_PlainText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="@string/autofillHints"
android:ems="10"
android:hint="@string/hint"
android:inputType="XXX" />
<>3,AutoCompleteTextView
<AutoCompleteTextView
android:id="@+id/autoCompleteTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autofillHints="@string/autofillHints"
android:hint="@string/hint" />
<>4. MultiAutoCompleteTextView
<MultiAutoCompleteTextView
android:id="@+id/multiAutoCompleteTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint" />
<>5. CheckedTextView
<CheckedTextView
android:id="@+id/checkedTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<>6. android.support.design.widget.TextInputXXX
<android.support.design.widget.TextInputLayout
android:id="@+id/textInputLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.TextInputEditText
android:id="@+id/textInputEditText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint" />
</android.support.design.widget.TextInputLayout>