Basic methods of Android--autocompletetextview use

Source: Internet
Author: User

Basic methods of Autocompletetextview use

What is Autocompletetextview? Automatic Reminders .

There must be one thing that provides data to Autocompletetextview. Dropdownmenu

1. Declare a autocompletetextview in the layout file

    < Autocompletetextview         Android:id = "@+id/autocomplete"         android:layout_width= "Match_parent"        android:layout_height= "Wrap_ Content "/>

The ID used here is the hump naming method .

2, define a hint entry style, new list_item.xml

 <?  xml version= "1.0" encoding= "Utf-8"  ?>  <  textview  xmlns:android  = "Http://schemas.android.com/apk/res/android"   Android:layout_width  = "Match_parent"   Android:textsize  = "16sp"   Android:textcolor  = "#000"   Android:layout_height  = "Match_parent"     >  </ textview  >  

3. Create a arrayadapter to provide data for Autocompletetextview

Here is the dynamic way, not the dead data ~

New Arraylist<string> (); List.add ("ABCD"); List.add ("Abeb"); ArrayadapterNew arrayadapter<string> (this, r.layout.list_item,list);  The list can be passed an array here.

4. linking Arrayadapter and Autocompletetextview

Autocompletetextview.setadapter (Arrayadapter);

Enter at least two characters and enter one that does not appear.

timepicker just set the date, this is set time ~!

Basic methods of Android--autocompletetextview use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.