0

我有一个EditText这样的:

<EditText
     android:id="@+id/txt_login_username"
     android:layout_width="300dp"
     android:layout_height="40dp"
     android:layout_above="@+id/pengala_logo"
     android:layout_alignLeft="@+id/txt_login_pwd"
     android:ems="10"
     android:hint="Please enter Email"
     android:inputType="textAutoComplete"
     android:textColorHint="#ffffff"
     android:textSize="20sp" />

当用户开始输入EditText. 与此类似

在此处输入图像描述

4

2 回答 2

1

为此使用Autocomplete TextView

当用户输入userName并按Autocomplete TextView登录时,您需要将用户名存储在 sharedpreferences 中。对于共享首选项,请参阅本教程

从 sharedpreferences 中选择输入的值,并在用户再次访问时将其显示在您的 Autocomplete TextView 中。

于 2013-08-08T06:52:51.873 回答
0

使用这个来实现这个

<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<jp.yokomark.widget.account.autocomp.AccountAutoCompleteEditText
    android:id="@+id/any"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="@string/label_account_type_any"
    app:accountType="any"/>

AccountAutoCompleteEditText 具有 accountType 的自定义属性。此属性接受以下任何值。

Value       Meaning
any         Show the candidate account of all type.
email       Show the candidate account using email address.
phoneNumber Show the candidate account using phone number.

这样您就可以轻松使用它

于 2015-02-24T06:56:44.940 回答