M
M
mortdekai2021-12-29 15:49:35
Android
mortdekai, 2021-12-29 15:49:35

AAPT error: error: attribute android:hintTextColor not found?

It is necessary to make a simple calculator, but it does not link the elements and the following AAPT error pops up: error: attribute android:hintTextColor not found.

<?xml version="1.0" encoding="utf-8"?>
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"
android:background="#fafafa"
tools:context=".MainActivity">

android:id="@+id/Num1"
android:layout_width ="0dp"
android:layout_height="0dp"
android:layout_marginStart="
android:layout_marginEnd="1dp"
android:layout_marginBottom="20dp"
android:ems="10"
android:hint="First number"
android:hintTextColor="#000000"
android:inputType="number"
android:textColor="# 546E7A"
app:layout_constraintBottom_toTopOf="@+id/Num2"
app:layout_constraintEnd_toEndOf="@+id/Num2"
app:layout_constraintStart_toStartOf="@+id/Num2"
app:layout_constraintTop_toTopOf="parent" />

android:id="@ +id/Num2"
android:layout_width="215dp"
android:layout_height="0dp"
android:layout_marginStart="20dp"
android:layout_marginBottom="56dp"
android:ems="10"
android:hint="Second number"
android:hintTextColor="#000000"
android:inputType="number"
android:minHeight="48dp"
android:textColor="# 546E7A"
app:layout_constraintBottom_toTopOf="@+id/Result"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/Num1" />

android:id="@+id/Result"
android:layout_width="105dp "
android:layout_height="0dp"
android:layout_marginEnd="98dp"
android:layout_marginBottom="7dp"
android:text="Result"
android:hintTextColor="#000000"
android:textColor="#546E7A"
android:textSize="20sp"
app:layout_constraintBottom_toTopOf="@+id/sum"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ Num2" />

android:id="@+id/sum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="36dp"
android:layout_marginBottom="365dp"
android:text="+"
android:hintTextColor="#000000"
android:textColor="#546E7A"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/Result" />

and

package com.example.nfpapp;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onButtonClick (View v) {
EditText el1 = (EditText) findViewById(R.id.Num1);
EditText el2 = (EditText) findViewById(R.id.Num2);
TextView resText = (TextView) findViewById(R.id.Result);
int num1 = Integer.parseInt(el1.getText().toString());
int num2 = Integer.parseInt(el2.getText().toString());
int resSum = num1 + num2;
resText.setText(Integer.toString(resSum));
}
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question