android 29 ArrarAdapter数组适配器

package com.sxt.day05_03;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainActivity extends Activity {
    ListView mlvWeek;
    ArrayAdapter<CharSequence> mAdapter;//CharSequence是安卓中的接口,字符序列
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
    }

    private void initView() {
        mlvWeek=(ListView) findViewById(R.id.lvWeek);
        mAdapter=ArrayAdapter.createFromResource(this, 
                R.array.day_of_week, //字符串数组
                android.R.layout.simple_expandable_list_item_1);//simple_expandable_list_item_1是布局,安卓系统的Item
        mlvWeek.setAdapter(mAdapter);
    }

}
android 29 ArrarAdapter数组适配器
android 29 ArrarAdapter数组适配器
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ListView
        android:id="@+id/lvWeek"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

</RelativeLayout>
android 29 ArrarAdapter数组适配器

 


本文转自农夫山泉别墅博客园博客,原文链接:http://www.cnblogs.com/yaowen/p/4887274.html,如需转载请自行联系原作者

上一篇:springmvc返回枚举属性值


下一篇:Phalcon入门教程之Volt模板引擎