Android Small Notes

Source: Internet
Author: User

A ListView is a data control that can display data read from a database and use TextView to implement output.


ImageView is a control for displaying pictures that you can get to a picture in the database to display the output.


arrayadapter Text adapter: Gets the data values in the collection, array, and, in particular, loads the adapter to get the contents of the adapter to output. Ways to implement the Arrayadapter adapter:

//Create an array first

private string[] CType = new string[]{"Content 1", "Content 2", "Content 3"};

//Gets the value in the array through the text adapter

arrayadapter<string> adater =

New Arrayadapter<string> (this,android. R.id.simple_spinner_item,ctype);

//Set the option style for the adapter when the list box is pulled down

Adapter.setdropdownviewresource (Android. R.layout.simple_spinner_dropdown_item);

//Load adapter Get results

Spinner.setadapter (adapter);


Simpleadapter Graphics Adapter : Used for matching correspondence between pictures and text.

//Create an array to hold the text and an array to hold the picture first

Private string[] CType = new string[]{"Content 1", "Content 2", "Content 3"};

private int img = new Int[]{r.drawable.logo,r.drawable.logo,r.drawable.logo,};

//Graphics adapter

list<map<string,object>> datas = new arraylist<map<string,object>> ();

for (int i = 0;i<object<length;i++) {

map<string,object> map = new map<string,object> ();

Map.put ("image", img[i]);

Map.put ("name", Ctype[i]);

Datas.add (map);

}

Simpleadapter adapter = new Simpleadapter (This,datas,r.layout.list_item,

New string[]{"image", "Name"},new int[]{r.id.iv_logo,r.id.tv_name});

//Load Adapter

Lv.setadapter (adapter);

There's also a custom adapter that hasn't been worked on, and will continue tomorrow! 650) this.width=650; "src=" Http://img.baidu.com/hi/bobo/B_0054.gif "alt=" B_0054.gif "/>

This article is from the "Android Small Notes" blog, please be sure to keep this source http://dreamwing.blog.51cto.com/9872128/1609817

Android Small Notes

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.