English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
This article illustrates a simple application of Android ListView. Shared for everyone's reference, as follows:
The content we will talk about today is the implementation of ListView in Android. It is divided into four steps, and I will explain them one by one:
Step one:Create a new Android project named ListViewDemo.
Step two:Find ListViewDemo.Java, and change the inherited Activity that we are accustomed to into ListActivity, as follows:
public class ListViewDemo extends ListActivity
Step three:The modification method of ListViewDemo.java code is as follows:
package com.android.test; import android.app.ListActivity; import android.os.Bundle; import android.widget.ArrayAdapter; public class ListViewDemo extends ListActivity { static final String[] COUNTRIES = new String[]{ "Americian","Belize","China","Japan","Korean","Russian" }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1 ,COUNTRIES)); } }
Step four:The effect of running it is as follows:
Today's content is easy, I didn't write events.
Readers who are interested in more content related to Android can check the special topics on this site: 'Summary of Android View View Skills', 'Summary of Android Layout Layout Skills', 'Summary of Android Graphics and Image Processing Skills', 'Android Development Tutorial for Beginners and Advanced', 'Summary of Android Debugging Skills and Common Problem Solving Methods', 'Summary of Android Multimedia Operation Skills (audio, video, recording, etc.)', 'Summary of Android Basic Component Usage', and 'Summary of Android Control Usage'
I hope the content described in this article will be helpful to everyone's Android program design.
Statement: The content of this article is from the Internet, the copyright belongs to the original author. The content is contributed and uploaded by Internet users spontaneously, and this website does not own the copyright, has not been manually edited, and does not assume any relevant legal responsibility. If you find any content suspected of copyright infringement, please send an email to: notice#w3Please report via email to codebox.com (replace # with @ when sending email) with relevant evidence. Once verified, this site will immediately delete the content suspected of infringement.