ConstraintLayout视图折叠

时间:2017-04-25 00:39:39

标签: android android-constraintlayout

当我运行应用程序(使用数字进行简单操作)时,设计会崩溃。

Here a screen capture

代码就是这样:

 protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    et1 = (EditText) findViewById(R.id.et1);
    //et2 = (EditText) findViewById(R.id.et2);
    tv1 = (TextView) findViewById(R.id.tv1);
}
  public void sumar(View view) {
    String valor1 = et1.getText().toString();
    //String valor2 = et2.getText().toString();
    int nro1 = Integer.parseInt(valor1);
   // int nro2 = Integer.parseInt(valor2);
    //int resultado = nro1+nro2;
    String res = String.valueOf(nro1);
    tv1.setText(res);
}

0 个答案:

没有答案