每次按下按钮时导致我的应用程序崩溃的原因是什么?

在我输入每门课程的学分和成绩后,然后按下计算 GPA 按钮,我的应用程序就崩溃了。


我尝试过调试,发现所有逻辑都运行良好,直到为我的 textview 设置文本。然后它崩溃并且不显示按钮下方的 GPA。


package com.example.gpa_tejadaa4_calculator;


import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;

import android.view.View;

import android.widget.Button;

import android.widget.EditText;

import android.widget.TextView;


public class MainActivity extends AppCompatActivity {


    private EditText ch1,ch2,ch3,ch4,ch5;

    private EditText g1,g2,g3,g4,g5;

    private Button gpa_calc;

    private TextView result;

    //private int credit_sum = 0;

    //private int grade_sum = 0;


    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);


        //Credit Hours

        ch1 = (EditText)findViewById(R.id.C_H1);

        ch2 = (EditText)findViewById(R.id.C_H2);

        ch3 = (EditText)findViewById(R.id.C_H3);

        ch4 = (EditText)findViewById(R.id.C_H4);

        ch5 = (EditText)findViewById(R.id.C_H5);


        //Grades

        g1= (EditText)findViewById(R.id.L_G1);

        g2= (EditText)findViewById(R.id.L_G2);

        g3= (EditText)findViewById(R.id.L_G3);

        g4= (EditText)findViewById(R.id.L_G4);

        g5= (EditText)findViewById(R.id.L_G5);


        //Button

        gpa_calc = (Button) findViewById(R.id.button);

        //Result

        result = (TextView)findViewById(R.id.result);


        gpa_calc.setOnClickListener(new View.OnClickListener() {

            @Override

            public void onClick(View v) {


                calculateGPA();

            }

        });

    }


    public void calculateGPA() {


        double quality_points = 0;

        double credit_sum = 0;

        double gpa=0;

        double chour1 = Double.valueOf(ch1.getText().toString());

        double chour2 = Double.valueOf(ch2.getText().toString());

        double chour3 = Double.valueOf(ch3.getText().toString());

        double chour4 = Double.valueOf(ch4.getText().toString());


湖上湖
浏览 83回答 2
2回答

神不在的星期二

public class MainActivity extends AppCompatActivity {&nbsp; &nbsp; private EditText ch1,ch2,ch3,ch4,ch5;&nbsp; &nbsp; private EditText g1,g2,g3,g4,g5;&nbsp; &nbsp; private Button gpa_calc;&nbsp; &nbsp; private TextView result;&nbsp; &nbsp; &nbsp;Double final =0;&nbsp; &nbsp; //private int credit_sum = 0;&nbsp; &nbsp; //private int grade_sum = 0;&nbsp; &nbsp; @Override&nbsp; &nbsp; protected void onCreate(Bundle savedInstanceState) {&nbsp; &nbsp; &nbsp; &nbsp; super.onCreate(savedInstanceState);&nbsp; &nbsp; &nbsp; &nbsp; setContentView(R.layout.activity_main);&nbsp; &nbsp; &nbsp; &nbsp; //Credit Hours&nbsp; &nbsp; &nbsp; &nbsp; ch1 = (EditText)findViewById(R.id.C_H1);&nbsp; &nbsp; &nbsp; &nbsp; ch2 = (EditText)findViewById(R.id.C_H2);&nbsp; &nbsp; &nbsp; &nbsp; ch3 = (EditText)findViewById(R.id.C_H3);&nbsp; &nbsp; &nbsp; &nbsp; ch4 = (EditText)findViewById(R.id.C_H4);&nbsp; &nbsp; &nbsp; &nbsp; ch5 = (EditText)findViewById(R.id.C_H5);&nbsp; &nbsp; &nbsp; &nbsp; //Grades&nbsp; &nbsp; &nbsp; &nbsp; g1= (EditText)findViewById(R.id.L_G1);&nbsp; &nbsp; &nbsp; &nbsp; g2= (EditText)findViewById(R.id.L_G2);&nbsp; &nbsp; &nbsp; &nbsp; g3= (EditText)findViewById(R.id.L_G3);&nbsp; &nbsp; &nbsp; &nbsp; g4= (EditText)findViewById(R.id.L_G4);&nbsp; &nbsp; &nbsp; &nbsp; g5= (EditText)findViewById(R.id.L_G5);&nbsp; &nbsp; &nbsp; &nbsp; //Button&nbsp; &nbsp; &nbsp; &nbsp; gpa_calc = (Button) findViewById(R.id.button);&nbsp; &nbsp; &nbsp; &nbsp; //Result&nbsp; &nbsp; &nbsp; &nbsp; result = (TextView)findViewById(R.id.result);&nbsp; &nbsp; &nbsp; &nbsp; gpa_calc.setOnClickListener(new View.OnClickListener() {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; @Override&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public void onClick(View v) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;final= calculateGPA();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result.setText(final.toString());&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; });&nbsp; &nbsp; }&nbsp; &nbsp; public double calculateGPA() {&nbsp; &nbsp; &nbsp; &nbsp; double quality_points = 0;&nbsp; &nbsp; &nbsp; &nbsp; double credit_sum = 0;&nbsp; &nbsp; &nbsp; &nbsp; double gpa=0;&nbsp; &nbsp; &nbsp; &nbsp; double chour1 = Double.valueOf(ch1.getText().toString());&nbsp; &nbsp; &nbsp; &nbsp; double chour2 = Double.valueOf(ch2.getText().toString());&nbsp; &nbsp; &nbsp; &nbsp; double chour3 = Double.valueOf(ch3.getText().toString());&nbsp; &nbsp; &nbsp; &nbsp; double chour4 = Double.valueOf(ch4.getText().toString());&nbsp; &nbsp; &nbsp; &nbsp; double chour5 = Double.valueOf(ch5.getText().toString());&nbsp; &nbsp; &nbsp; &nbsp; String l1 = String.valueOf(g1.getText());&nbsp; &nbsp; &nbsp; &nbsp; String l2 = String.valueOf(g2.getText());&nbsp; &nbsp; &nbsp; &nbsp; String l3 = String.valueOf(g3.getText());&nbsp; &nbsp; &nbsp; &nbsp; String l4 = String.valueOf(g4.getText());&nbsp; &nbsp; &nbsp; &nbsp; String l5 = String.valueOf(g5.getText());&nbsp; &nbsp; &nbsp; &nbsp; double[] creditArray = new double[]{chour1, chour2, chour3, chour4, chour5};&nbsp; &nbsp; &nbsp; &nbsp; String[] gradeArray = new String[]{l1,l2,l3,l4,l5};&nbsp; &nbsp; &nbsp; &nbsp; credit_sum = chour1+chour2+chour3+chour4+chour5;&nbsp; &nbsp; &nbsp; &nbsp; for(int i=0; i<gradeArray.length; i++){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (gradeArray[i].equals("A")){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; quality_points += (creditArray[i] * 4);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (gradeArray[i].equals("B")){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; quality_points += (creditArray[i] * 3);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (gradeArray[i].equals("C")){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; quality_points += (creditArray[i] * 2);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (gradeArray[i].equals("D")){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; quality_points += (creditArray[i] * 1);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (gradeArray[i].equals("F")){&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; quality_points += (creditArray[i] * 0);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; gpa = (quality_points/credit_sum);&nbsp; &nbsp; &nbsp; &nbsp; String str = Double.toString(gpa);&nbsp; &nbsp; &nbsp; &nbsp;return gpa;&nbsp; &nbsp; }}

吃鸡游戏

这可能与您的问题无关,但我修复了您的布局。当然,您仍然可以改进它。<?xml version="1.0" encoding="utf-8"?><android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"&nbsp; &nbsp; xmlns:app="http://schemas.android.com/apk/res-auto"&nbsp; &nbsp; xmlns:tools="http://schemas.android.com/tools"&nbsp; &nbsp; android:layout_width="match_parent"&nbsp; &nbsp; android:layout_height="match_parent"&nbsp; &nbsp; tools:context=".MainActivity">&nbsp; &nbsp; <EditText&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/L_G5"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="113dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="24dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginEnd="8dp"&nbsp; &nbsp; &nbsp; &nbsp; android:ems="10"&nbsp; &nbsp; &nbsp; &nbsp; android:hint="@string/Grade"&nbsp; &nbsp; &nbsp; &nbsp; android:importantForAutofill="no"&nbsp; &nbsp; &nbsp; &nbsp; android:inputType="textPersonName"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintBaseline_toBaselineOf="@+id/C_H5"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintEnd_toEndOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toEndOf="@+id/C_H5"&nbsp; &nbsp; &nbsp; &nbsp; tools:targetApi="o" />&nbsp; &nbsp; <EditText&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/L_G4"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="113dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="32dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginEnd="8dp"&nbsp; &nbsp; &nbsp; &nbsp; android:ems="10"&nbsp; &nbsp; &nbsp; &nbsp; android:hint="@string/Grade"&nbsp; &nbsp; &nbsp; &nbsp; android:importantForAutofill="no"&nbsp; &nbsp; &nbsp; &nbsp; android:inputType="textPersonName"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintBaseline_toBaselineOf="@+id/C_H4"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintEnd_toEndOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toEndOf="@+id/C_H4"&nbsp; &nbsp; &nbsp; &nbsp; tools:targetApi="o" />&nbsp; &nbsp; <EditText&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/C_H5"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="114dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="32dp"&nbsp; &nbsp; &nbsp; &nbsp; android:ems="10"&nbsp; &nbsp; &nbsp; &nbsp; android:hint="@string/credit_hours"&nbsp; &nbsp; &nbsp; &nbsp; android:importantForAutofill="no"&nbsp; &nbsp; &nbsp; &nbsp; android:inputType="textPersonName"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintBaseline_toBaselineOf="@+id/c5"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toEndOf="@+id/c5"&nbsp; &nbsp; &nbsp; &nbsp; tools:targetApi="o" />&nbsp; &nbsp; <TextView&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/c5"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="70dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="24dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginTop="50dp"&nbsp; &nbsp; &nbsp; &nbsp; android:text="@string/course_5"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toStartOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintTop_toBottomOf="@+id/c4" />&nbsp; &nbsp; <TextView&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/c3"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="70dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="24dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginTop="50dp"&nbsp; &nbsp; &nbsp; &nbsp; android:text="@string/course_3"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toStartOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintTop_toBottomOf="@+id/c2" />&nbsp; &nbsp; <EditText&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/C_H4"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="110dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="32dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginLeft="32dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginTop="24dp"&nbsp; &nbsp; &nbsp; &nbsp; android:ems="10"&nbsp; &nbsp; &nbsp; &nbsp; android:hint="@string/credit_hours"&nbsp; &nbsp; &nbsp; &nbsp; android:inputType="textPersonName"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toEndOf="@+id/c4"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintTop_toBottomOf="@+id/C_H3"&nbsp; &nbsp; &nbsp; &nbsp; android:importantForAutofill="no" tools:targetApi="o" />&nbsp; &nbsp; <TextView&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/c4"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="70dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="24dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginTop="50dp"&nbsp; &nbsp; &nbsp; &nbsp; android:text="@string/course_4"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toStartOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintTop_toBottomOf="@+id/c3" />&nbsp; &nbsp; <EditText&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/L_G3"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="113dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="32dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginEnd="8dp"&nbsp; &nbsp; &nbsp; &nbsp; android:ems="10"&nbsp; &nbsp; &nbsp; &nbsp; android:hint="@string/Grade"&nbsp; &nbsp; &nbsp; &nbsp; android:importantForAutofill="no"&nbsp; &nbsp; &nbsp; &nbsp; android:inputType="textPersonName"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintBaseline_toBaselineOf="@+id/C_H3"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintEnd_toEndOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toEndOf="@+id/C_H3"&nbsp; &nbsp; &nbsp; &nbsp; tools:targetApi="o" />&nbsp; &nbsp; <EditText&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/C_H3"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="110dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="32dp"&nbsp; &nbsp; &nbsp; &nbsp; android:ems="10"&nbsp; &nbsp; &nbsp; &nbsp; android:hint="@string/credit_hours"&nbsp; &nbsp; &nbsp; &nbsp; android:importantForAutofill="no"&nbsp; &nbsp; &nbsp; &nbsp; android:inputType="textPersonName"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintBaseline_toBaselineOf="@+id/c3"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toEndOf="@+id/c3"&nbsp; &nbsp; &nbsp; &nbsp; tools:targetApi="o" />&nbsp; &nbsp; <EditText&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/L_G2"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="112dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="32dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginEnd="8dp"&nbsp; &nbsp; &nbsp; &nbsp; android:ems="10"&nbsp; &nbsp; &nbsp; &nbsp; android:hint="@string/Grade"&nbsp; &nbsp; &nbsp; &nbsp; android:importantForAutofill="no"&nbsp; &nbsp; &nbsp; &nbsp; android:inputType="textPersonName"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintBaseline_toBaselineOf="@+id/C_H2"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintEnd_toEndOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toEndOf="@+id/C_H2"&nbsp; &nbsp; &nbsp; &nbsp; tools:targetApi="o" />&nbsp; &nbsp; <EditText&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/C_H2"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="110dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="32dp"&nbsp; &nbsp; &nbsp; &nbsp; android:ems="10"&nbsp; &nbsp; &nbsp; &nbsp; android:hint="@string/credit_hours"&nbsp; &nbsp; &nbsp; &nbsp; android:importantForAutofill="no"&nbsp; &nbsp; &nbsp; &nbsp; android:inputType="textPersonName"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintBaseline_toBaselineOf="@+id/c2"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toEndOf="@+id/c2"&nbsp; &nbsp; &nbsp; &nbsp; tools:targetApi="o" />&nbsp; &nbsp; <TextView&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/c2"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="70dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="21dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="24dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginTop="50dp"&nbsp; &nbsp; &nbsp; &nbsp; android:text="@string/course_2"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toStartOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintTop_toBottomOf="@+id/c1" />&nbsp; &nbsp; <TextView&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/c1"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="70dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="24dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginTop="112dp"&nbsp; &nbsp; &nbsp; &nbsp; android:text="@string/course_1"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toStartOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintTop_toTopOf="parent" />&nbsp; &nbsp; <EditText&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/C_H1"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="110dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="32dp"&nbsp; &nbsp; &nbsp; &nbsp; android:ems="10"&nbsp; &nbsp; &nbsp; &nbsp; android:hint="@string/credit_hours"&nbsp; &nbsp; &nbsp; &nbsp; android:importantForAutofill="no"&nbsp; &nbsp; &nbsp; &nbsp; android:inputType="numberDecimal"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintBaseline_toBaselineOf="@+id/c1"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toEndOf="@+id/c1"&nbsp; &nbsp; &nbsp; &nbsp; tools:targetApi="o" />&nbsp; &nbsp; <EditText&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/L_G1"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="110dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="32dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginEnd="8dp"&nbsp; &nbsp; &nbsp; &nbsp; android:ems="10"&nbsp; &nbsp; &nbsp; &nbsp; android:hint="@string/Grade"&nbsp; &nbsp; &nbsp; &nbsp; android:importantForAutofill="no"&nbsp; &nbsp; &nbsp; &nbsp; android:inputType="textPersonName"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintBaseline_toBaselineOf="@+id/C_H1"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintEnd_toEndOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toEndOf="@+id/C_H1"&nbsp; &nbsp; &nbsp; &nbsp; tools:targetApi="o" />&nbsp; &nbsp; <Button&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/button"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="8dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginLeft="8dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginTop="78dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginEnd="8dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginRight="8dp"&nbsp; &nbsp; &nbsp; &nbsp; android:text="@string/compute_gpa"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintEnd_toEndOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintHorizontal_bias="0.498"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toStartOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintTop_toBottomOf="@+id/C_H5" />&nbsp; &nbsp; <TextView&nbsp; &nbsp; &nbsp; &nbsp; android:id="@+id/result"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_width="66dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_height="wrap_content"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginStart="170dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginTop="46dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginEnd="175dp"&nbsp; &nbsp; &nbsp; &nbsp; android:layout_marginBottom="119dp"&nbsp; &nbsp; &nbsp; &nbsp; android:textSize="18sp"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintBottom_toBottomOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintEnd_toEndOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintStart_toStartOf="parent"&nbsp; &nbsp; &nbsp; &nbsp; app:layout_constraintTop_toBottomOf="@+id/button" /></android.support.constraint.ConstraintLayout>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java