【小白做项目-01(成绩分析APP)】手把手教你Android实战开发

【小白做项目-01】

本文为Karthus77原创转载请说明

一、项目需求

  1. 设计一款成绩分析报告APP,要求输入学科名,学科成绩与绩点
  2. 生成对应成绩报告单
  3. 生成对应的成绩评价并给出建议

二、项目分析

总体上看,我们可以为这个项目设计3个activity
1.用户输入界面
2.成绩单界面
3.建议界面
在获取用户输入的成绩等信息后,按照要求对其进行处理并显示在成绩单界面和建议界面
涉及到的知识点如下:

  1. Intent在Activity中的信息传递
  2. Toast吐司的简单使用
  3. UI设计的基本思路

三、效果展示

四、实战操作

1. 搭建活动

创建3个Activity

2.输入成绩界面UI

每一个活动对应了一个XML文件,也就是布局文件
在这里插入图片描述

这个界面我用了Linearlayout和Relativelayout结合的方法
线性布局将界面用weight参数调整为6部分  

其中的每一小块利用线性布局写,无需线性布局
这里给出2,3,4,5部分的布局代码

<LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="2"
                android:orientation="vertical"
                android:background="@drawable/background">

                <EditText
                    android:id="@+id/subjectFirst"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:hint="请输入学科名称(至多10个字符)"
                    android:textSize="10sp"
                    android:textColor="#3299CC"
                    android:layout_marginLeft="25sp"
                    android:inputType="text">

                </EditText>

                <EditText
                    android:id="@+id/EnterMath"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="25sp"
                    android:hint="请输入您的成绩(0~100)"
                    android:inputType="number"
                    android:textSize="10sp">

                </EditText>

                <EditText
                    android:id="@+id/gradeMath"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="25sp"
                    android:hint="请输入学分(0~10)"
                    android:inputType="number"
                    android:textSize="10sp">

                </EditText>


            </LinearLayout>

`在这段代码中,我们利用了hint进行输入提示
inputType进行简单的输入拦截
我们可以看到在每小块输入框外面有一层边框
在这里插入图片描述这是利用一张矩形图片在父布局实现的效果

3.输入界面Activity

在输入界面我们应该考虑的问题是,我们在这个界面需要获得学生输入的学科成绩,那么就应该保证学生输入信息的合理性获得学生输入信息并传入到成绩报告的Activity中

第一步 绑定控件

在这里插入图片描述在onCreate方法中绑定控件(生命周期的问题在后面的项目中会讲到)

第二步 设置点击事件

   bt.setOnClickListener(new View.OnClickListener() {
    
    
            @Override
            public void onClick(View v) {
    
    
                String math =EdM.getText().toString();
                String English = EdE.getText().toString();
                String C = EdC.getText().toString();
                String CS = EdCS.getText().toString();
                String gMath =gradMath.getText().toString();
                String gEnglish =gradEnglish.getText().toString();
                String gCl=gradC.getText().toString();
                String gCS1=gradCS.getText().toString();
                String titleFirst=subjectFirst.getText().toString();
                String titleSecond=subjectSecond.getText().toString();
                String titleThird=subjectThird.getText().toString();
                String titleFourth=subjectFourth.getText().toString();
                if(TextUtils.isEmpty(math)||TextUtils.isEmpty(English)||TextUtils.isEmpty(C)||TextUtils.isEmpty(CS)
                        ||TextUtils.isEmpty(gMath)||TextUtils.isEmpty(gEnglish)||TextUtils.isEmpty(gCl)||TextUtils.isEmpty(gCS1)||TextUtils.isEmpty(titleFirst)||TextUtils.isEmpty(titleSecond)||TextUtils.isEmpty(titleThird)||TextUtils.isEmpty(titleFourth))
                {
    
    
                    Toast.makeText(InputActivity.this,"输入不能为空!",Toast.LENGTH_LONG).show();
                }
                else if (math.length() > 3 || English.length() > 3 ||
                        C.length() > 3 || CS.length() > 3|| gMath.length() > 3 || gEnglish.length() > 3 || gCl.length() > 3 || gCS1.length() > 3||titleFirst.length()>10||titleSecond.length()>10||titleThird.length()>10||titleFourth.length()>10) {
    
    
                    Toast.makeText(InputActivity.this, "您输入的数据或字符过大!", Toast.LENGTH_LONG).show();
                }


                    else
                {
    
    

                int gM = Integer.parseInt(gMath);
                int gE = Integer.parseInt(gEnglish);
                int gC = Integer.parseInt(gCl);
                int gCS = Integer.parseInt(gCS1);
                int m = Integer.parseInt(math);
                int E = Integer.parseInt(English);
                int c = Integer.parseInt(C);
                int cs = Integer.parseInt(CS);
                        Toast.makeText(InputActivity.this, "生成成功!", Toast.LENGTH_LONG).show();
                        Intent intent = new Intent(InputActivity.this, ReportActivity.class);
                        Bundle bd = new Bundle();
                        bd.putInt("gradeMath", gM);
                        bd.putInt("gradeC", gC);
                        bd.putInt("gradeEnglish", gE);
                        bd.putInt("gradeCS", gCS);
                        bd.putInt("math", m);
                        bd.putInt("English", E);
                        bd.putInt("C", c);
                        bd.putInt("CS", cs);
                        bd.putString("First", titleFirst);
                        bd.putString("Second", titleSecond);
                        bd.putString("Third", titleThird);
                        bd.putString("Fourth", titleFourth);
                        intent.putExtras(bd);
                        startActivity(intent);

                    }

                }




    }

在设置生成报告的点击事件中,我们首先获取输入数据
利用if else分支结构简单判断然后利用Toast工具对于不同形式给出提示
如果符合标准则将数据传入下一个Activity中
下图是Intent的简单数据传递的例子
利用键值对的方式进行数据存贮,类似于Map

在这里插入图片描述

4. 报告界面UI

在这里插入图片描述

将报告界面代码直接放上,设计思路和输入界面相同
代码如果直接粘贴复制的话请注意其中替换图片资源为你的本地文件

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ReportActivity">
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:layout_weight="5">
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1">

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="146dp">

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerHorizontal="true"
                        android:text="成绩评估"
                        android:textColor="#3299CC"
                        android:layout_marginTop="20sp"
                        android:textSize="20sp">

                    </TextView>

                    <ImageView
                        android:id="@+id/enterBack1"
                        android:layout_width="30sp"
                        android:layout_height="30sp"
                        android:layout_alignParentLeft="true"
                        android:layout_marginTop="20sp"
                        android:layout_marginRight="20sp"
                        android:src="@drawable/back">

                    </ImageView>

                    <ImageView
                        android:id="@+id/AnalyseEnter"
                        android:layout_width="30sp"
                        android:layout_height="30sp"
                        android:layout_alignParentRight="true"
                        android:layout_marginTop="20sp"
                        android:layout_marginRight="20sp"
                        android:src="@drawable/report">

                    </ImageView>

                </RelativeLayout>

            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:orientation="vertical">


                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:background="@drawable/background">
                    <TextView
                        android:id="@+id/firstSubject"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="高等数学"
                        android:textSize="20dp"
                        android:layout_marginTop="10sp"
                        android:textColor="#3299CC"
                        android:layout_marginLeft="30sp">

                    </TextView>

                    <TextView
                        android:id="@+id/scoreMath"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentBottom="true"
                        android:layout_marginLeft="30sp"
                        android:layout_marginBottom="10dp"
                        android:text="成绩:"
                        android:textSize="20dp">


                    </TextView>

                    <TextView
                        android:id="@+id/rateMath"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_marginRight="40dp"
                        android:text="A"
                        android:textSize="40dp">

                    </TextView>

                    <TextView
                        android:id="@+id/gpaMath"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentBottom="true"
                        android:layout_marginLeft="160dp"
                        android:layout_marginBottom="10dp"
                        android:text="绩点:"
                        android:textSize="20dp">

                    </TextView>


                </RelativeLayout>



            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@drawable/background">
                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent">
                    <TextView
                        android:id="@+id/secondSubject"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="大学英语"
                        android:textSize="20dp"
                        android:layout_marginTop="10sp"
                        android:textColor="#3299CC"
                        android:layout_marginLeft="30sp">

                    </TextView>
                    <TextView
                        android:id="@+id/scoreEnglish"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentBottom="true"
                        android:text="成绩:"
                        android:textSize="20dp"
                        android:layout_marginLeft="30sp"
                        android:layout_marginBottom="10dp">

                    </TextView>

                    <TextView
                        android:id="@+id/rateEnglish"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_marginRight="40dp"
                        android:text="A"
                        android:textSize="40dp">

                    </TextView>

                    <TextView
                        android:id="@+id/gpaEnglish"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentBottom="true"
                        android:layout_marginLeft="160dp"
                        android:text="绩点:"
                        android:textSize="20dp"
                        android:layout_marginBottom="10dp">

                    </TextView>


                </RelativeLayout>


            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:background="@drawable/background">
                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent">
                    <TextView
                        android:id="@+id/thirdSubject"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="计算机导论"
                        android:textSize="20dp"
                        android:layout_marginTop="10sp"
                        android:textColor="#3299CC"
                        android:layout_marginLeft="30sp"
                        android:layout_marginBottom="10dp">

                    </TextView>
                    <TextView
                        android:id="@+id/scoreCS"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentBottom="true"
                        android:text="成绩:"
                        android:textSize="20dp"
                        android:layout_marginLeft="30sp"
                        android:layout_marginBottom="10dp">

                    </TextView>

                    <TextView
                        android:id="@+id/rateCS"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_marginRight="40dp"
                        android:text="A"
                        android:textSize="40dp">

                    </TextView>

                    <TextView
                        android:id="@+id/gpaCS"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentBottom="true"
                        android:layout_marginLeft="160dp"
                        android:text="绩点:"
                        android:textSize="20dp"
                        android:layout_marginBottom="10dp">

                    </TextView>


                </RelativeLayout>

            </LinearLayout>
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1">
                <RelativeLayout
                    android:layout_width="wrap_content"
                    android:layout_height="match_parent"
                    android:background="@drawable/background">
                    <TextView
                        android:id="@+id/fourthSubject"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="C语言程序设计"
                        android:textSize="20dp"
                        android:textColor="#3299CC"
                        android:layout_marginTop="10sp"
                        android:layout_marginLeft="30sp">

                    </TextView>
                    <TextView
                        android:id="@+id/scoreC"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentBottom="true"
                        android:text="成绩:"
                        android:textSize="20dp"
                        android:layout_marginLeft="30sp"
                        android:layout_marginBottom="10dp">

                    </TextView>

                    <TextView
                        android:id="@+id/rateC"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentRight="true"
                        android:layout_marginRight="40dp"
                        android:text="A"
                        android:textSize="40dp">

                    </TextView>

                    <TextView
                        android:id="@+id/gpaC"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentBottom="true"
                        android:layout_marginLeft="160dp"
                        android:text="绩点:"
                        android:textSize="20dp"
                        android:layout_marginBottom="10dp">

                    </TextView>



                </RelativeLayout>

            </LinearLayout>
        </LinearLayout>
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="10"
            android:orientation="horizontal">
            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="4"
                android:background="@drawable/background">

                <ImageView
                    android:id="@+id/image3"
                    android:layout_width="120dp"
                    android:layout_height="120sp"
                    android:layout_alignParentTop="true"
                    android:layout_marginTop="10dp"
                    android:layout_marginLeft="20dp"
                    android:src="@drawable/circle">


                </ImageView>

                <TextView
                    android:id="@+id/weightScore"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentTop="true"
                    android:layout_marginLeft="52dp"
                    android:layout_marginTop="50dp"
                    android:text="78.5"
                    android:textColor="#3299CC"
                    android:textSize="30sp">

                </TextView>

                <TextView
                    android:id="@+id/totalScore"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:layout_marginLeft="30sp"
                    android:layout_marginBottom="28dp"
                    android:text="总学分:"
                    android:textSize="20sp">

                </TextView>

                <TextView
                    android:id="@+id/totalGpa"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/image3"
                    android:text="绩点:"
                    android:textSize="20sp"
                    android:layout_marginLeft="30sp">

                </TextView>

            </RelativeLayout>


            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="4">
                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="@drawable/background">

                    <ImageView
                        android:id="@+id/image1"
                        android:layout_width="80sp"
                        android:layout_height="80sp"
                        android:src="@drawable/re1"
                        android:layout_marginLeft="20sp"
                        android:layout_marginTop="20sp">

                    </ImageView>

                    <ImageView
                        android:id="@+id/image2"
                        android:layout_width="80sp"
                        android:layout_height="80sp"
                        android:layout_alignParentBottom="true"
                        android:layout_marginBottom="20sp"
                        android:src="@drawable/re2"
                        android:layout_marginLeft="20sp">

                    </ImageView>

                    <TextView
                        android:id="@+id/stability"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_toRightOf="@id/image1"
                        android:text="稳定性:"
                        android:textSize="15sp"
                        android:layout_marginTop="20sp">

                    </TextView>

                    <TextView
                        android:id="@+id/stabilityResult"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/stability"
                        android:layout_marginLeft="15dp"
                        android:layout_marginTop="10dp"
                        android:layout_toRightOf="@id/image1"
                        android:text="良好"
                        android:textSize="25sp">

                    </TextView>

                    <TextView
                        android:id="@+id/overallRank"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_toRightOf="@id/image2"
                        android:layout_centerVertical="true"
                        android:text="综合评级:"
                        android:textSize="15sp">

                    </TextView>

                    <TextView
                        android:id="@+id/overallRankResult"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/overallRank"
                        android:layout_marginLeft="28dp"
                        android:layout_marginTop="14dp"
                        android:layout_toRightOf="@id/image2"
                        android:text="A"
                        android:textSize="50sp" >

                    </TextView>
                </RelativeLayout>


            </LinearLayout>

        </LinearLayout>

    </LinearLayout>


</androidx.constraintlayout.widget.ConstraintLayout>

5.报告界面活动

在报告界面我们要处理几个方面

  1. 获取输入界面的数据
  2. 处理数据并显示
  3. 返回输入界面的按钮
  4. 跳转下一个界面的按钮

第一步 数据读取
利用键值对获取从Intent中获取数据在这里插入图片描述

第二步 数据处理与显示
处理部分比较繁杂,只是一些数学计算,在这里就不放了
显示部分用setText即可
在这里插入图片描述
放一部分供参考

第三步 返回界面
在这里插入图片描述
为返回按钮设置点击事件,利用finish杀死当前Activity

第四步 跳转到下一界面
同样用Intent存贮数据并传入下一个活动中
在这里插入图片描述

6.分析界面UI

界面与前两个类似就不放代码了

7.分析界面活动

这一部分就是利用Intent传递进来的成绩,来显示不同的信息
代码直接放上,自己看即可(与前面的大同小异)

package com.example.app1test;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

public class AnalyseActivity extends AppCompatActivity {
    
    
    private TextView mathSuggestion;
    private TextView EnglishSuggestion;
    private TextView cSuggestion;
    private TextView csSuggestion;
    private ImageView back;
    private TextView suggestion;
    private TextView one;
    private TextView two;
    private TextView three;
    private TextView four;
    private ImageView face;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_analyse);
        TextView mathSuggestion=findViewById(R.id.mathSuggestion);
        TextView EnglishSuggestion=findViewById(R.id.EnglishSuggestion);
        TextView cSuggestion=findViewById(R.id.cSuggestion);
        TextView csSuggestion=findViewById(R.id.csSuggestion);
        TextView suggestion=findViewById(R.id.suggestion);
        ImageView back=findViewById(R.id.enterBack2);
        ImageView face=findViewById(R.id.circle2);
        one=findViewById(R.id.anOne);
        two=findViewById(R.id.anTwo);
        three=findViewById(R.id.anThree);
        four=findViewById(R.id.anFour);
        Intent it2=getIntent();//获得数据
        Bundle bt=it2.getExtras();
        int Math=bt.getInt("Math");
        int English=bt.getInt("English");
        int C=bt.getInt("C");
        int CS=bt.getInt("CS");
        double grade=bt.getDouble("overall");
        double fangCha=bt.getDouble("fc");
        String numberOne=bt.getString("one");
        String numberTwo=bt.getString("two");
        String numberThree=bt.getString("three");
        String numberFour=bt.getString("four");
        one.setText(numberOne);
        two.setText(numberTwo);
        three.setText(numberThree);
        four.setText(numberFour);
        if(grade>=80&&fangCha<=4)
        {
    
    
            suggestion.setText("你的总体成绩表现为优秀,各科成绩比较稳定");
            face.setImageResource(R.drawable.face1);
        }
        else if(grade>80&&fangCha>4)
        {
    
    
            suggestion.setText("你的总体成绩表现为优秀,但存在偏科现象,请注意!");
            face.setImageResource(R.drawable.face1);
        }
        else if(grade>70&&fangCha>4&&fangCha<10)
        {
    
    
            suggestion.setText("你的成绩一般且存在偏科现象,请注意!");
            face.setImageResource(R.drawable.hhhh);
        }
        else if(grade>70&&fangCha<=4)
        {
    
    
            suggestion.setText("你的成绩一般,但还好比较稳定");
            face.setImageResource(R.drawable.hhhh);
        }
        else if(grade>70&&fangCha>=10)
        {
    
    
            suggestion.setText("你的成绩一般,但偏科有点严重啊!");
            face.setImageResource(R.drawable.hhhh);
        }
        else if(grade>60)
        {
    
    
            suggestion.setText("好好学习吧,你还是有机会的");
            face.setImageResource(R.drawable.face2);
        }
        else
        {
    
    
            suggestion.setText("小伙子,你这成绩就不用我给你分析了吧!");
            face.setImageResource(R.drawable.face2);
        }
        if(Math>=90)
        {
    
    
            mathSuggestion.setText("建议:成绩表现优异,继续努力!");
        }
        else  if(Math>=80)
        {
    
    
            mathSuggestion.setText("建议:成绩表现不错,继续加油!");
        }
        else if(Math>=70)
        {
    
    
            mathSuggestion.setText("建议:你的进步空间还很大,好好加油吧!");
        }
        else if(Math>=60)
        {
    
    
            mathSuggestion.setText("建议:你已经处在挂科边缘了!!!");
        }
        else
        {
    
    
            mathSuggestion.setText("挂科快乐!补考加油!");
        }
        if(English>=90)
        {
    
    
            EnglishSuggestion.setText("建议:成绩表现优异,继续努力!");
        }
        else  if(English>=80)
        {
    
    
            EnglishSuggestion.setText("建议:成绩表现不错,继续加油!");
        }
        else if(English>=70)
        {
    
    
            EnglishSuggestion.setText("建议:你的进步空间还很大,好好加油吧!");
        }
        else if(English>=60)
        {
    
    
            EnglishSuggestion.setText("建议:你已经处在挂科边缘了!!!");
        }
        else
        {
    
    
            EnglishSuggestion.setText("挂科快乐!补考加油!");
        }
        if(C>=90)
        {
    
    
            cSuggestion.setText("建议:成绩表现优异,继续努力!");
        }
        else  if(C>=80)
        {
    
    
            cSuggestion.setText("建议:成绩表现不错,继续加油!");
        }
        else if(C>=70)
        {
    
    
            cSuggestion.setText("建议:你的进步空间还很大,好好加油吧!");
        }
        else if(C>=60)
        {
    
    
            cSuggestion.setText("建议:你已经处在挂科边缘了!!!");
        }
        else
        {
    
    
            cSuggestion.setText("挂科快乐!补考加油!");
        }
        if(CS>=90)
        {
    
    
            csSuggestion.setText("建议:成绩表现优异,继续努力!");
        }
        else  if(CS>=80)
        {
    
    
            csSuggestion.setText("建议:成绩表现不错,继续加油!");
        }
        else if(CS>=70)
        {
    
    
            csSuggestion.setText("建议:你的进步空间还很大,好好加油吧!");
        }
        else if(CS>=60)
        {
    
    
            csSuggestion.setText("建议:你已经处在挂科边缘了!!!");
        }
        else
        {
    
    
            csSuggestion.setText("挂科快乐!补考加油!");
        }
        back.setOnClickListener(new View.OnClickListener() {
    
    
            @Override
            public void onClick(View v) {
    
    
                finish();
            }
        });
    }
}

五、总结

这是一个非常基础的项目,主要训练简单APP的制作。
目的在于了解app的设计流程,设计思想,控件的基本使用,Toast和Intent的使用。

这篇博客并没有完全给出所有代码,如果你是小白,能够在这篇博客的基础上做出一个类似的APP,那么恭喜你入门了,后续会给出更多Android项目的教程

想要项目源码的私信我即可,希望我们一起进步,加油!

猜你喜欢

转载自blog.csdn.net/Karthus77/article/details/113178367