Step by Step _android Development Course [19]_ User Interface ListView (List view)

Source: Internet
Author: User

Focus on technology, enjoy life! --qq:804212028
Browse Links: http://blog.csdn.net/y18334702058/article/details/44624305

    • Topic: ListView of the User interface (list view)
      -listview and Textview,button are the same way of defining and displaying, so they are no longer repeated. But the ListView in Android development often fits some adapters to display, so we have to learn to focus on the various adaptations of the ListView.

Arrayadapter adaptation display for ListView

<?xml version= "1.0" encoding= "Utf-8"?><linearlayout xmlns:android="Http://schemas.android.com/apk/res/android"  Android:orientation="vertical"android:layout_width="Fill_parent"android: Layout_height="Fill_parent" >                <ListViewandroid:id="@+id/listview"android:layout_width= "Fill_parent" android:layout_height="wrap_content" />                         </linearlayout>

Mainactivity.java Source code:

Importandroid.app.Activity;ImportAndroid.os.Bundle;ImportAndroid.widget.ArrayAdapter;ImportAndroid.widget.ListView; Public  class mainactivity extends Activity {    PrivateListView ListView; String[] str={"AA","BB","CC","DD","ee"};@Override    protected void onCreate(Bundle savedinstancestate) {Super. OnCreate (Savedinstancestate);        Setcontentview (R.layout.activity_main);        ListView = (ListView) Findviewbyid (R.id.listview); arrayadapter<string> adapter =NewArrayadapter<string> ( ThisAndroid.        R.layout.simple_list_item_1, str);    Listview.setadapter (adapter); }}

Operation Result:

It's a little late today. Tomorrow I will continue to update, but also a lot of knowledge points.
Step by step series of courses, will continue to edit repeatedly, remove some previously not written good, add new good things. So this series of blog posts will always be getting better and more comprehensive. If you have any support, please pay attention to this series.

Focus on technology, enjoy life! --qq:804212028
Browse Links: http://blog.csdn.net/y18334702058/article/details/44624305

Step by Step _android Development Course [19]_ User Interface ListView (List view)

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.