zoukankan      html  css  js  c++  java
  • 手机界面

    .xml

    <?xml version="1.0" encoding="utf-8"?>
    <GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:rowCount="8"
        android:columnCount="4"
        android:padding="10dp"
        >
    
            <ImageView
                android:layout_width="90dp"
                android:layout_height="90dp"
                android:scaleType="fitXY"
                android:src="@drawable/a1"
                android:padding="10dp"
                android:id="@+id/t_1"
                />
            <ImageView
                android:layout_width="90dp"
                android:layout_height="90dp"
                android:scaleType="fitXY"
                android:src="@drawable/a2"
                android:padding="10dp"
                android:id="@+id/t_2"
                />
            <ImageView
                android:layout_width="90dp"
                android:layout_height="90dp"
                android:scaleType="fitXY"
                android:src="@drawable/a3"
                android:padding="10dp"
                android:id="@+id/t_3"
                />
            <ImageView
                android:layout_width="90dp"
                android:layout_height="90dp"
                android:scaleType="fitXY"
                android:src="@drawable/a4"
                android:padding="10dp"
                android:id="@+id/t_4"
    
                />
        <TextView
    
            android:text="记事本"
            android:paddingBottom="10dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/x_1"
            />
        <TextView
    
            android:text="写字"
            android:paddingBottom="10dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/x_2"/>
        <TextView
    
            android:text="电话"
            android:paddingBottom="10dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/x_3"/>
        <TextView
    
            android:text="钢琴"
            android:paddingBottom="10dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/x_4"/>
    
        <ImageView
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:scaleType="fitXY"
            android:src="@drawable/a5"
            android:padding="10dp"
            android:id="@+id/t_5"
            />
        <ImageView
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:scaleType="fitXY"
            android:src="@drawable/a6"
            android:padding="10dp"
            android:id="@+id/t_6"/>
        <ImageView
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:scaleType="fitXY"
            android:src="@drawable/a7"
            android:padding="10dp"
            android:id="@+id/t_7"/>
        <ImageView
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:scaleType="fitXY"
            android:src="@drawable/a8"
            android:padding="10dp"
            android:id="@+id/t_8"/>
        <TextView
    
            android:text="飞机票"
            android:paddingBottom="10dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/x_5"/>
        <TextView
    
            android:text="位置"
            android:paddingBottom="10dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/x_6"/>
        <TextView
    
            android:text="WIFI"
            android:paddingBottom="10dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/x_7"/>
        <TextView
    
            android:text="星星"
            android:paddingBottom="10dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/x_8"/>
        <ImageView
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:scaleType="fitXY"
            android:src="@drawable/a9"
            android:padding="10dp"
            android:id="@+id/t_9"
            />
        <ImageView
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:scaleType="fitXY"
            android:src="@drawable/a10"
            android:padding="10dp"
            android:id="@+id/t_10"/>
        <ImageView
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:scaleType="fitXY"
            android:src="@drawable/a11"
            android:padding="10dp"
            android:id="@+id/t_11"/>
        <ImageView
            android:layout_width="90dp"
            android:layout_height="90dp"
            android:scaleType="fitXY"
            android:src="@drawable/a12"
            android:padding="10dp"
            android:id="@+id/t_12"/>
        <TextView
    
            android:text="电影"
            android:paddingBottom="10dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/x_9"/>
        <TextView
    
            android:text="旅游"
            android:paddingBottom="10dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/x_10"/>
        <TextView
    
            android:text="电话簿"
            android:paddingBottom="10dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/x_11"/>
        <TextView
    
            android:text="手电筒"
            android:paddingBottom="10dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/x_12"/>
    
    </GridLayout>

    .java

    package com.hanqi.application3;
    
    import android.os.Bundle;
    import android.support.v7.app.AppCompatActivity;
    import android.view.View;
    import android.widget.ImageView;
    import android.widget.Toast;
    
    public class LXActivity1 extends AppCompatActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_lx1);
    
            ImageView t1 = (ImageView)findViewById(R.id.t_1);
            ImageView t2 = (ImageView)findViewById(R.id.t_2);
            ImageView t3 = (ImageView)findViewById(R.id.t_3);
            ImageView t4 = (ImageView)findViewById(R.id.t_4);
            ImageView t5 = (ImageView)findViewById(R.id.t_5);
            ImageView t6 = (ImageView)findViewById(R.id.t_6);
            ImageView t7 = (ImageView)findViewById(R.id.t_7);
            ImageView t8 = (ImageView)findViewById(R.id.t_8);
            ImageView t9 = (ImageView)findViewById(R.id.t_9);
            ImageView t10 = (ImageView)findViewById(R.id.t_10);
            ImageView t11 = (ImageView)findViewById(R.id.t_11);
            ImageView t12 = (ImageView)findViewById(R.id.t_12);
    
    //        final TextView x1 = (TextView)findViewById(R.id.x_1);
    //        TextView x2 = (TextView)findViewById(R.id.x_2);
    //        TextView x3 = (TextView)findViewById(R.id.x_3);
    //        TextView x4 = (TextView)findViewById(R.id.x_4);
    //        TextView x5 = (TextView)findViewById(R.id.x_5);
    //        TextView x6 = (TextView)findViewById(R.id.x_6);
    //        TextView x7 = (TextView)findViewById(R.id.x_7);
    //        TextView x8 = (TextView)findViewById(R.id.x_8);
    //        TextView x9 = (TextView)findViewById(R.id.x_9);
    //        TextView x10 = (TextView)findViewById(R.id.x_10);
    //        TextView x11 = (TextView)findViewById(R.id.x_11);
    //        TextView x12 = (TextView)findViewById(R.id.x_12);
    
            t1.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(LXActivity1.this, "记事本", Toast.LENGTH_SHORT).show();
                }
            });
            t2.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(LXActivity1.this, "写字", Toast.LENGTH_SHORT).show();
                }
            });
            t3.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(LXActivity1.this, "电话", Toast.LENGTH_SHORT).show();
                }
            });
            t4.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(LXActivity1.this, "钢琴", Toast.LENGTH_SHORT).show();
                }
            });
            t5.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(LXActivity1.this, "飞机票", Toast.LENGTH_SHORT).show();
                }
            });
            t6.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(LXActivity1.this, "位置", Toast.LENGTH_SHORT).show();
                }
            });
            t7.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(LXActivity1.this, "WIFI", Toast.LENGTH_SHORT).show();
                }
            });
            t8.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(LXActivity1.this, "星星", Toast.LENGTH_SHORT).show();
                }
            });
            t9.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(LXActivity1.this, "电影", Toast.LENGTH_SHORT).show();
                }
            });
            t10.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(LXActivity1.this, "旅游", Toast.LENGTH_SHORT).show();
                }
            });
            t11.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(LXActivity1.this, "电话簿", Toast.LENGTH_SHORT).show();
                }
            });
            t12.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Toast.makeText(LXActivity1.this, "手电筒", Toast.LENGTH_SHORT).show();
                }
            });
        }
    }
  • 相关阅读:
    Python 多线程与多进程
    Python3 Scrapy 安装方法
    吴恩达深度学习笔记 course4 week4 测验
    吴恩达深度学习笔记 course4 week 4 特殊应用:人脸识别与神经风格转换
    吴恩达深度学习笔记 course4 week3 测验
    吴恩达深度学习笔记 course4 week1 作业2
    吴恩达深度学习笔记 course4 week3 目标检测
    吴恩达深度学习笔记 course4 week2 作业1
    吴恩达深度学习笔记 course4 week2 测验
    DreamWeaver使用小结
  • 原文地址:https://www.cnblogs.com/cuikang/p/5376592.html
Copyright © 2011-2022 走看看