Android--listview Click events

Source: Internet
Author: User

Adapter equivalent to C (Controller, controllers),

The ListView is equivalent to V (view) for displaying data

A list that provides data to the ListView, an array or a database equivalent to M (model) in MVC mode

The ListView only knows that the data displayed is from Adapter and does not know whether it is from an array or a list object. For the data, only know that the data is used in the adapter inside,

There are three ways of these values: Arrayadapter, Simpleadapter, Simplecursoradapter

Arrayadapter is the simplest kind of adapter, which is a string value that can only be displayed in the ListView text message.

Simpleadapter is a custom data source, to customize the layout way, you can place pictures, buttons, text and so on.

Simplecursoradapter data comes from the database.

Onitemselectedlistener list item is selected when triggered

Onitemclicklistener When you click the list to trigger

By default, the first item is selected. You can use Listview.setselection (6) To set the 7th item selected

Add a quick slide slide bar.

Add android:fastscrollenabled= "True" inside the XML ListView. There must be at least 4 scrolling pages to have a quick slide bar

Android--listview Click events

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.