AndroidAutoCompleteTextView实现自动补全
郑州app开发Android AutoCompleteTextView实现自动补全。
创新互联-专业网站定制、快速模板网站建设、高性价比安康网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式安康网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖安康地区。费用合理售后完善,10年实体公司更值得信赖。
activity_main.xml
{androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".MainActivity" }
{AutoCompleteTextView
android:id="@+id/actv_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hint="请输入内容"
android:completionThreshold="1"
app:layout_constraintbottom_tobottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /}
{/androidx.constraintlayout.widget.ConstraintLayout}
item.xml
android:layout_width="match_parent" android:layout_height="match_parent" android:textColor="@android:color/black">
MainActivity.java
package cn.xhhkj.videoview;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import android.app.FragmentTransaction;
import android.media.Mediaplayer;
import android.os.bundle;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.Imagebutton;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "结果是";
private String[] names = {"laowang","laozhang","laoli","xiaowang","xiaozhang","xiaoli"};
@Override
protected void onCreate(bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AutoCompleteTextView actv =findViewbyId(R.id.actv_text);
ArrayAdapter
actv.setAdapter(adapter);
}
}
名称栏目:AndroidAutoCompleteTextView实现自动补全
本文路径:http://cdiso.cn/article/sccdjd.html