一.所花时间

0.5h

二.代码量

30行

三.博客量

1篇

四.了解到的知识点

编辑框EditText

编辑框EditText用于接收软键盘输入的文字,例如用户名、密码、评价内容等,它由文本视图派生而
来,除了TextView已有的各种属性和方法,EditText还支持下列XML属性。
inputType:指定输入的文本类型。输入类型的取值说明见表5-4,若同时使用多种文本类型,则可
使用竖线“|”把多种文本类型拼接起来。
maxLength:指定文本允许输入的最大长度。
hint:指定提示文本的内容。
textColorHint:指定提示文本的颜色。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:padding="5dp"
 android:orientation="vertical" >
 <TextView
android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:layout_marginTop="5dp"
 android:text="下面是登录信息"
 android:textColor="@color/black"
 android:textSize="17sp" />
 <EditText
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:inputType="text"
 android:maxLength="10"
 android:hint="请输入用户名"
 android:textColor="@color/black"
 android:textSize="17sp" />
 <EditText
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:inputType="textPassword"
 android:maxLength="8"
 android:hint="请输入密码"
 android:textColor="@color/black"
 android:textSize="17sp" />            
</LinearLayout>

 

posted on 2024-05-12 23:32  leapss  阅读(10)  评论(0)    收藏  举报