У меня есть xml вот так
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/layout_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="34dp"
android:layout_marginEnd="34dp"
android:textColorHint="@color/grey_40"
android:theme="@style/EditText.Black">
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/edit_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="17sp"
android:inputType="phone"
android:textColor="@android:color/black"
android:fontFamily="@font/poppinsregular"/>
</com.google.android.material.textfield.TextInputLayout>
И затем 2 стиля темы, черный и белый, как вы можете видеть, я использую черную тему по умолчанию для моего textinputlayout, но теперь мне нужно измените его на красный на этом коде:
private void checklogin(){
nomor_handphone = findViewById(R.id.edit_phone);
if(!nomor_handphone.getText().toString().equals("1234567890")){
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
//code for change theme from @style/EditText.Black to @style/EditText.Red
}
}, 2000);
}
Вы можете мне помочь?