zoukankan      html  css  js  c++  java
  • 简易列表

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
    
        tools:context="com.hanqi.zuoye.liebiaoviewActivity">
    
        <ListView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/lv"></ListView>
    
    
    </LinearLayout>

    显示界面

    <?xml version="1.0" encoding="utf-8"?>
    
        <TextView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
        android:textSize="20sp"
        android:paddingTop="10dp"
        android:paddingBottom="10dp"/>

    准备的列表样界面

    package com.hanqi.zuoye;
    
    import android.os.Bundle;
    import android.support.v7.app.AppCompatActivity;
    import android.widget.ArrayAdapter;
    import android.widget.ListView;
    
    public class liebiaoviewActivity extends AppCompatActivity {
    
        ListView lv;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_liebiaoview);
            lv=(ListView)findViewById(R.id.lv);
    
            //1-数据集合 Layout文件
            String []st={"A1","A2","A3","A4","A5","A6","A7","A8","A9","A0","A1","A2","A3","A4","A5","A6","A7","A8","A9","A0",};
            //创建Adpter
            ArrayAdapter<String> arrayAdapter=new ArrayAdapter<String>(this,R.layout.array_liebiao,st);
            //绑定到ListView
            lv.setAdapter(arrayAdapter);
        }
    }

    java代码

  • 相关阅读:
    linux最简单项目部署
    sql索引
    /etc/profile和~/.bash_profile区别
    Linux下查找软件的目录位置
    为什么要使用消息队列?
    idea中常用的快捷键
    PAT 甲级 1023 Have Fun with Numbers (20分)
    PAT《算法笔记》
    Text 2
    Text-1
  • 原文地址:https://www.cnblogs.com/storm47/p/5501945.html
Copyright © 2011-2022 走看看