Android list Implementation (1) _ Array List Instance Introduction _android

Source: Internet
Author: User
Recently began to learn the Android UI, a few related examples, the follow-up will be updated.
Copy Code code as follows:

Import android.app.ListActivity;
Import Android.os.Bundle;
Import Android.widget.ArrayAdapter;


/**
* A List View example where the
* Data for the "list comes from" an array of strings.
*/
public class List1 extends Listactivity {

@Override
public void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);

Use a existing listadapter that'll map an array
of strings to Textviews
Setlistadapter New Arrayadapter<string> (This,
Android. R.layout.simple_list_item_1, mstrings));
Getlistview (). Settextfilterenabled (True);
}

Private string[] Mstrings = {
"Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "abondance", "Ackawi",
"Acorn", "Adelost", "Affidelice au Chablis", "Afuega ' L Pitu", "Airag", "Airedale",
"Aisy Cendre", "Allgauer Emmentaler", "Alverca", "Ambert", "American Cheese",
"Ami du Chambertin", "Anejo Enchilado", "Anneau du Vic-bilh", "Anthoriro", "Appenzell",
"Aragon", "Ardi Gasna", "Ardrahan", "Armenian String", "aromes au Gene de Marc",
"Asadero", "Asiago", "Aubisque Pyrenees", "Autun", "Avaxtskyr", "Baby Swiss",
"Babybel", "Baguette laonnaise", "Bakers", "Baladi", "Balaton", "Bandal", "Banon",
"Barry's Bay Cheddar", "basing", "Basket Cheese", "Bath Cheese", "Bavarian bergkase",
"Baylough", "Beaufort", "Beauvoorde", "Beenleigh Blue", "Beer Cheese", "Bel Paese",
"Bergader", "Bergere Bleue", "Berkswell", "Beyaz Peynir", "Bierkase", "Bishop Kennedy",
"Blarney", "Bleu d ' Auvergne", "Bleu de Gex", "Bleu de Laqueuille",
"Bleu de Septmoncel", "Bleu Des causses", "Blue", "Blue Castello", "Blue Rathgore",
"Blue vein (Australian)", "Blue vein cheeses", "Bocconcini", "Bocconcini (Australian)",
"Boeren Leidenkaas", "Bonchester", "Bosworth", "Bougon", "Boule Du roves",
"Boulette d ' Avesnes", "Boursault", "Boursin", "Bouyssou", "Bra", "Braudostur",
"Breakfast Cheese", "Brebis du lavort", "Brebis du Lochois", "Brebis du Puyfaucon",
"Bresse Bleu", "Brick", "Brie", "Brie de Meaux", "Brie de Melun", "Brillat-Savarin",
"Brin", "Brin d ' Amour", "Brin d ' Amour", "Brinza (Burduf Brinza)",
"Briquette de Brebis", "Briquette du Forez", "Broccio", "Broccio demi-affine",
"Brousse du Rove", "Bruder Basil", "Brusselae Kaas (fromage de Bruxelles)", "Bryndza",
"Buchette d ' Anjou", "Buffalo", "Burgos", "Butte", "Butterkase", "button (Innes)",
"Buxton Blue", "Cabecou", "Caboc", "Cabrales", "Cachaille", "Caciocavallo", "Caciotta",
"Caerphilly", "Cairnsmore", "Calenzana", "Cambazola", "Camembert de Normandie",
"Canadian Cheddar", "Canestrato", "Cantal", "Caprice des Dieux", "Capricorn Goat",
"Capriole Banon", "Carre de l ' Est", "Casciotta di Urbino", "Cashel Blue", "Castellano",
"Castelleno", "Castelmagno", "Castelo Branco", "Castigliano", "Cathelain",
"Celtic Promise", "Cendre d ' Olivet", "Cerney", "Chabichou", "Chabichou du Poitou",
"Chabis de Gatine", "Chaource", "Charolais", "Chaumes", "Cheddar",
"Cheddar Clothbound", "Cheshire", "Chevres", "Chevrotin des Aravis", "Chontaleno",
"Civray", "coeur de Camembert au Calvados", "Coeur de Chevre", "Colby", "Cold Pack",
"Comte", "Coolea", "Cooleney", "Coquetdale", "Corleggy", "Cornish Pepper",
"Cotherstone", "Cotija", "Cottage Cheese", "Cottage Cheese (Australian)",
"Cougar Gold", "Coulommiers", "Coverdale", "Crayeux de Roncq", "Cream Cheese",
"Cream Havarti", "Crema Agria", "Crema mexicana", "creme fraiche", "Crescenza",
"Croghan", "Crottin de Chavignol", "Crottin du Chavignol", "Crowdie", "Crowley",
"Cuajada", "curd", "Cure Nantais", "Curworthy", "Cwmtawe pecorino",
"Cypress Grove chevre", "Danablu (Danish Blue)", "Danbo", "Danish Fontina",
"Daralagjazsky", "Dauphin", "Delice des fiouves", "Denhany Dorset Drum", "Derby",
"Dessertnyj Belyj", "Devon Blue", "Devon Garland", "Dolcelatte", "Doolin",
"Doppelrhamstufel", "Dorset Blue Vinney", "Double Gloucester", "Double Worcester",
"Dreux a la feuille", "Dry Jack", "Duddleswell", "Dunbarra", "Dunlop", "Dunsyre Blue",
"Duroblando", "Durrus", "Dutch Mimolette (Commissiekaas)", "Edam", "Edelpilz",
"Emental Grand Cru", "Emlett", "Emmental", "Epoisses de Bourgogne", "Esbareich",
"Esrom", "Etorki", "Evansdale farmhouse Brie", "Evora De L ' Alentejo", "Exmoor Blue",
"Explorateur", "feta", "feta (Australian)", "Figue", "Filetta", "fin-de-siecle",
"Finlandia Swiss", "Finn", "Fiore Sardo", "Fleur du maquis", "Flor de Guia",
"Flower Marie", "Folded", "Folded cheese with mint", "fondant de brebis",
"Fontainebleau", "Fontal", "Fontina Val d ' Aosta", "Formaggio di Capra", "Fougerus",
"Four Herb Gouda", "Fourme d ' Ambert", "Fourme de Haute Loire", "Fourme de Montbrison",
"Fresh Jack", "fresh mozzarella", "fresh Ricotta", "Fresh Truffles", "Fribourgeois",
"Friesekaas", "Friesian", "Friesla", "Frinault", "Fromage a Raclette", "Fromage Corse",
"Fromage de montagne de Savoie", "Fromage Frais," "Fruit Cream Cheese",
"Frying Cheese", "Fynbo", "Gabriel", "Galette du paludier", "Galette Lyonnaise",
"Galloway Goat ' s Milk Gems", "Gammelost", "Gaperon a l ' Ail", "Garrotxa", "Gastanberra",
"Geitost", "Gippsland Blue", "Gjetost", "Gloucester", "Golden Cross", "Gorgonzola",
"Gornyaltajski", "Gospel Green", "Gouda", "Goutu", "Gowrie", "Grabetto", "Graddost",
"Grafton Village Cheddar", "Grana", "Grana Padano", "Grand Vatel",
"Grataron d ' areches", "Gratte-paille", "Graviera", "Greuilh", "Greve",
"Gris de Lille", "Gruyere", "Gubbeen", "Guerbigny", "Halloumi",
"Halloumy (Australian)", "Haloumi-style Cheese", "Harbourne Blue", "Havarti",
"Heidi Gruyere", "Hereford Hop", "Herrgardsost", "Herriot farmhouse", "Herve",
"Hipi Iti", "Hubbardston Blue Cow", "Hushallsost", "Iberico", "Idaho goatster",
"Idiazabal", "Il Boschetto al Tartufo", "Ile d ' Yeu", "Isle of Mull", "Jarlsberg",
"Jermi tortes", "Jibneh Arabieh", "Jindi Brie", "Jubilee Blue", "Juustoleipa",
"Kadchgall", "Kaseri", "Kashta", "Kefalotyri", "Kenafa", "Kernhem", "Kervella affine",
"Kikorangi", "King Island Cape Wickham Brie", "King River Gold", "Klosterkaese",
"Knockalara", "Kugelkase", "L ' Aveyronnais", "L ' ecir de l ' Aubrac", "La taupiniere",
"La Vache qui Rit", "Laguiole", "Lairobell", "Lajta", "Lanark Blue", "Lancashire",
"Langres", "Lappi", "Laruns", "Lavistown", "Le Brin", "Le Fium Orbo", "Le Lacandou",
"Le Roule", "Leafield", "Lebbene", "Leerdammer", "Leicester", "Leyden", "Limburger",
"Lincolnshire Poacher", "Lingot Saint Bousquet d ' Orb", "Liptauer", "Little rydings",
"Livarot", "Llanboidy", "Llanglofan farmhouse", "Loch Arthur farmhouse",
"Loddiswell Avondale", "Longhorn", "Lou Palou", "Lou Pevre", "Lyonnais", "Maasdam",
"Macconais", "Mahoe aged Gouda", "Mahon", "Malvern", "Mamirolle", "Manchego",
"Manouri", "Manur", "Marble cheddar", "marbled cheeses", "maredsous", "Margotin",
"Maribo", "Maroilles", "mascares", "mascarpone", "mascarpone (Australian)",
"Mascarpone Torta", "Matocq", "Maytag Blue", "Meira", "Menallack farmhouse",
"Menonita", "Meredith Blue", "Mesost", "Metton (Cancoillotte)", "Meyer Vintage Gouda",
"Mihalic Peynir", "Milleens", "Mimolette", "Mine-gabhar", "Mini Baby Bells", "mixte",
"Molbo", "Monastery cheeses", "Mondseer", "Mont D ' or Lyonnais", "Montasio",
"Monterey Jack", "Monterey Jack Dry", "Morbier", "Morbier Cru de montagne",
"Mothais a la feuille", "mozzarella", "mozzarella (Australian)",
"Mozzarella di bufala", "mozzarella fresh, in water", "mozzarella Rolls", "Munster",
"Murol", "Mycella", "Myzithra", "Naboulsi", "Nantais", "Neufchatel",
"Neufchatel (Australian)", "Niolo", "Nokkelost", "Northumberland", "Oaxaca",
"Olde York", "Olivet au foin", "Olivet Bleu", "Olivet Cendre",
"Orkney Extra Mature Cheddar", "Orla", "Oschtjepka", "Ossau fermier", "Ossau-iraty",
"Oszczypek", "Oxford Blue", "P ' Tit Berrichon", "Palet de Babligny", "Paneer", "Panela",
"Pannerone", "Pant ys Gawn", "Parmesan (Parmigiano)", "Parmigiano Reggiano",
"Pas de l ' Escalette", "Passendale", "pasteurized processed", "Pate de fromage",
"Patefine Fort", "Pave d ' Affinois", "Pave d ' Auge", "Pave de Chirac", "Pave du Berry",
"Pecorino", "Pecorino in Walnut Leaves", "Pecorino Romano", "Peekskill Pyramid",
"Pelardon des Cevennes", "Pelardon des Corbieres", "Penamellera", "Penbryn",
"Pencarreg", "Perail de Brebis", "Petit Morin", "Petit Pardou", "Petit-suisse",
"Picodon de Chevre", "Picos de Europa", "Piora", "pithtviers au foin",
"Plateau de Herve", "Plymouth Cheese", "Podhalanski", "Poivre d ' ane", "Polkolbin",
"Pont l ' Eveque", "Port Nicholson", "Port-salut", "Postel", "Pouligny-saint-pierre",
"Pourly", "Prastost", "Pressato", "Prince-jean", "Processed cheddar", "provolone",
"Provolone (Australian)", "Pyengana Cheddar", "Pyramide", "Quark",
"Quark (Australian)", "Quartirolo Lombardo", "quatre-vents", "Quercy Petit",
"Queso Blanco", "Queso Blanco con frutas--pina y Mango", "Queso de Murcia",
"Queso del montsec", "Queso del Tietar", "Queso Fresco", "Queso Fresco (Adobera)",
"Queso Iberico", "Queso jalapeno", "Queso Majorero", "Queso Media Luna",
"Queso Para frier", "Queso quesadilla", "rabacal", "Raclette", "Ragusano", "Raschera",
"Reblochon", "Red Leicester", "Regal de la Dombes", "Reggianito", "Remedou",
"Requeson", "Richelieu", "Ricotta", "Ricotta (Australian)", "Ricotta salata", "Ridder",
"Rigotte", "Rocamadour", "Rollot", "Romano", "Romans part Dieu", "roncal", "Roquefort",
"Roule", "Rouleau De Beaulieu", "Royalp Tilsit", "Rubens", "Rustinu", "Saaland Pfarr",
"Saanenkaese", "Saga", "Sage Derby", "Sainte Maure", "Saint-marcellin",
"Saint-nectaire", "Saint-paulin", "Salers", "Samso", "San Simon", "Sancerre",
"Sap Sago", "Sardo", "Sardo Egyptian", "Sbrinz", "Scamorza", "Schabzieger", "Schloss",
"Selles sur Cher", "Selva", "Serat", "seriously strong cheddar", "Serra da Estrela",
"Sharpam", "Shelburne Cheddar", "Shropshire Blue", "Siraz", "Sirene", "Smoked Gouda",
"Somerset Brie", "Sonoma Jack", "Sottocenare al Tartufo", "Soumaintrain",
"Sourire Lozerien", "Spenwood", "Sraffordshire Organic", "St. Agur Blue Cheese",
"Stilton", "Stinking Bishop", "String", "Sussex Slipcote", "Sveciaost", "Swaledale",
"Sweet Style Swiss", "Swiss", "Syrian (Armenian String)", "Tala", "Taleggio", "Tamie",
"Tasmania Highland chevre Log", "Taupiniere", "Teifi", "Telemea", "Testouri",
"Tete de Moine", "Tetilla", "Texas Goat Cheese", "Tibet", "Tillamook Cheddar",
"Tilsit", "Timboon Brie", "Toma", "Tomme brulee", "Tomme d ' abondance",
"Tomme de Chevre", "Tomme de Romans", "Tomme de Savoie", "Tomme des Chouans", "Tommes",
"Torta del Casar", "Toscanello", "Touree de L ' Aubier", "Tourmalet",
"Trappe (veritable)", "Trois Cornes De Vendee", "Tronchon", "Trou du Cru", "Truffe",
"Tupi", "Turunmaa", "Tymsboro", "Tyn Grug", "tyning", "Ubriaco", "Ulloa",
"Vacherin-fribourgeois", "Valencay", "Vasterbottenost", "Venaco", "Vendomois",
"Vieux Corse", "Vignotte", "Vulscombe", "Waimata farmhouse Blue",
"Washed Rind Cheese (Australian)", "Waterloo", "Weichkaese", "Wellington",
"Wensleydale", "White Stilton", "Whitestone Farmhouse", "Wigmore", "Woodside Cabecou",
"Xanadu", "Xynotyro", "Yarg Cornish", "Yarra Valley Pyramid", "Yorkshire Blue",
"Zamorano", "Zanetti Grana Padano," "Zanetti Parmigiano Reggiano"};
}

The Android list shows essentially the process of applying a template to the data, and let's look at the template definition in this example: Simple_list_item_1.xml
Copy Code code as follows:

<?xml version= "1.0" encoding= "Utf-8"?>
<!--Copyright (C) 2006 the Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
You are not to use this file except in compliance with the License.
You could obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable or agreed to in writing, software
Distributed under the License is distributed on ' as is ' basis,
Without warranties or CONDITIONS of any KIND, either express or implied.
The License for the specific language governing permissions and
Limitations under the License.
-->

<textview xmlns:android= "Http://schemas.android.com/apk/res/android"
Android:id= "@android: Id/text1"
Android:layout_width= "Match_parent"
android:layout_height= "Wrap_content"
Android:textappearance= "Android:attr/textappearancelistitemsmall"?
Android:gravity= "Center_vertical"
Android:paddingleft= "Android:attr/listpreferreditempaddingleft"?
Android:paddingright= "Android:attr/listpreferreditempaddingright"?
Android:minheight= "Android:attr/listpreferreditemheightsmall"?
/>

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.