zoukankan      html  css  js  c++  java
  • 第六次作业

    package com.example.zuoye6;
    
    import androidx.appcompat.app.AppCompatActivity;
    
    import android.app.Activity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Adapter;
    import android.widget.ArrayAdapter;
    import android.widget.ListView;
    import android.widget.SimpleAdapter;
    
    
    import java.util.ArrayList;
    import java.util.HashMap;
    import java.util.List;
    import java.util.Map;
    
    public class MainActivity extends Activity{
    private ListView listView;
        @Override protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            ListView lv = (ListView) findViewById(R.id.lv1);
            List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
            Map<String,Object>map = new HashMap<String,Object>();
            map.put("logo",R.drawable.jingdong);
            map.put("title","京东商城");
            map.put("version","版本:2.4.3");
            map.put("size","大小:78.3MB");
            list.add(map);
    
            map = new HashMap<String,Object>();
            map.put("logo",R.drawable.doudizhu);
            map.put("title","QQ斗地主");
            map.put("version","版本:4.0.8");
            map.put("size","大小:134.7MB");
            list.add(map);
    
            map = new HashMap<String,Object>();
            map.put("logo",R.drawable.liulanqi);
            map.put("title","UC浏览器");
            map.put("version","版本:3.8.5");
            map.put("size","大小:63.2MB");
            list.add(map);
    
            map = new HashMap<String,Object>();
            map.put("logo",R.drawable.tianmao);
            map.put("title","天猫商城");
            map.put("version","版本:5.6.4");
            map.put("size","大小:88.3MB");
            list.add(map);
    
            map = new HashMap<String,Object>();
            map.put("logo",R.drawable.xinlangweibo);
            map.put("title","新浪微博");
            map.put("version","版本:4.1.6");
            map.put("size","大小:89.6MB");
            list.add(map);
    
            map = new HashMap<String,Object>();
            map.put("logo",R.drawable.weixin);
            map.put("title","微信");
            map.put("version","版本:6.0.3");
            map.put("size","大小:216.3MB");
            list.add(map);
    
            map = new HashMap<String,Object>();
            map.put("logo",R.drawable.qq);
            map.put("title","QQ");
            map.put("version","版本:7.8.3");
            map.put("size","大小:178.3MB");
            list.add(map);
    
            SimpleAdapter adapter = new SimpleAdapter(
                    this,
                    list,R.layout.item,
                    new String[]{"logo","title","version","size"},
                    new int[]{R.id.logo,R.id.title,R.id.version,R.id.size}
            );
    lv.setAdapter(adapter);
        }
    }
     1 <?xml version="1.0" encoding="utf-8"?>
     2 <LinearLayout
     3     xmlns:android="http://schemas.android.com/apk/res/android"
     4     xmlns:app="http://schemas.android.com/apk/res-auto"
     5     xmlns:tools="http://schemas.android.com/tools"
     6     android:layout_width="match_parent"
     7     android:layout_height="match_parent"
     8     tools:context=".MainActivity">
     9 
    10     <ListView
    11         android:id="@+id/lv1"
    12         android:layout_width="fill_parent"
    13         android:layout_height="fill_parent">
    14 
    15     </ListView>
    16 </LinearLayout>
     1 <?xml version="1.0" encoding="utf-8"?>
     2 <RelativeLayout
     3     xmlns:android="http://schemas.android.com/apk/res/android"
     4     android:layout_width="match_parent"
     5     android:layout_height="match_parent"
     6 android:descendantFocusability="blocksDescendants">
     7 
     8 
     9 
    10     <RelativeLayout
    11         android:id="@+id/box"
    12         android:background="#FCFDFC"
    13         android:layout_width="match_parent"
    14         android:layout_height="wrap_content"
    15         android:layout_marginLeft="5dp"
    16         android:layout_marginRight="5dp"
    17         android:padding="5dp"/>
    18 
    19 <ImageView
    20     android:id="@+id/logo"
    21     android:layout_width="70dp"
    22     android:layout_height="70dp"
    23     android:src="@drawable/jingdong"
    24     android:layout_centerVertical="true"/>
    25 
    26 
    27     <Button
    28         android:id="@+id/bt1"
    29         android:layout_width="wrap_content"
    30         android:layout_height="wrap_content"
    31         android:text="安装"
    32         android:layout_alignParentRight="true"
    33         android:layout_centerVertical="true"
    34         />
    35 
    36 
    37     <LinearLayout
    38         android:id="@+id/textbox"
    39         android:layout_width="match_parent"
    40         android:layout_height="70dp"
    41         android:layout_toRightOf="@+id/logo"
    42         android:layout_toLeftOf="@+id/bt1"
    43         android:layout_centerVertical="true"
    44         android:orientation="vertical"
    45 
    46 
    47         >
    48         <TextView
    49             android:id="@+id/title"
    50             android:layout_width="wrap_content"
    51             android:layout_height="wrap_content"
    52             android:layout_marginTop="3dp"
    53             android:text="京东商城"
    54             android:textSize="16sp" />
    55 
    56 
    57         <TextView
    58             android:id="@+id/version"
    59             android:layout_width="wrap_content"
    60             android:layout_height="wrap_content"
    61             android:layout_marginTop="5dp"
    62             android:text="版本:2.4.3"
    63             android:textColor="#666666"
    64             android:textSize="13sp" />
    65 
    66         <TextView
    67             android:id="@+id/size"
    68             android:layout_width="wrap_content"
    69             android:layout_height="wrap_content"
    70             android:layout_marginTop="5dp"
    71             android:text="大小:78.3MB"
    72             android:textColor="#666666"
    73             android:textSize="13sp" />
    74 
    75 
    76     </LinearLayout>
    77 
    78 </RelativeLayout>

  • 相关阅读:
    单例模式
    js事件
    oracle_to_excel
    jquery_2
    jquery_1
    4.linux 复制,删除,重命名
    一个tomcat下部署多个springboot项目
    3.centos7 安装oracle
    桥接模式
    组合模式
  • 原文地址:https://www.cnblogs.com/96111314w/p/11628170.html
Copyright © 2011-2022 走看看