Не знаю, если это поможет, но вот часть моего стандартного файла конфигурации для проектов php. Я не слишком зависеть от конфигураций apache даже на моем собственном сервере.
У меня никогда не возникает проблемы с исчезновением ошибки, поэтому, возможно, что-то здесь даст вам представление.
Отредактировано для показа APPLICATON_LIVE
/*
APPLICATION_LIVE will be used in process to tell if we are in a development or production environment. It's generally set as early as possible (often the first code to run), before any config, url routing, etc.
*/
if ( preg_match( "%^(www.)?livedomain.com$%", $_SERVER["HTTP_HOST"]) ) {
define('APPLICATION_LIVE', true);
} elseif ( preg_match( "%^(www.)?devdomain.net$%", $_SERVER["HTTP_HOST"]) ) {
define('APPLICATION_LIVE', false);
} else {
die("INVALID HOST REQUEST (".$_SERVER["HTTP_HOST"].")");
// Log or take other appropriate action.
}
/*
--------------------------------------------------------------------
DEFAULT ERROR HANDLING
--------------------------------------------------------------------
Default error logging. Some of these may be changed later based on APPLICATION_LIVE.
*/
error_reporting(E_ALL & ~E_STRICT);
ini_set ( "display_errors", "0");
ini_set ( "display_startup_errors", "0");
ini_set ( "log_errors", 1);
ini_set ( "log_errors_max_len", 0);
ini_set ( "error_log", APPLICATION_ROOT."logs/php_error_log.txt");
ini_set ( "display_errors", "0");
ini_set ( "display_startup_errors", "0");
if ( ! APPLICATION_LIVE ) {
// A few changes to error handling for development.
// We will want errors to be visible during development.
ini_set ( "display_errors", "1");
ini_set ( "display_startup_errors", "1");
ini_set ( "html_errors", "1");
ini_set ( "docref_root", "http://www.php.net/");
ini_set ( "error_prepend_string", "<div style='color:red; font-family:verdana; border:1px solid red; padding:5px;'>");
ini_set ( "error_append_string", "</div>");
}
Вы должны обернуть ваш EditText внутри TextInputLayout (он поставляется с некоторыми классными анимациями из коробки), тогда вы сможете установить любой цвет для EditText.
xml:
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/inputLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="36dp"
app:passwordToggleEnabled="true"
app:passwordToggleDrawable="@drawable/selector_password_toggle"
app:passwordToggleTint="@android:color/black"
app:errorTextAppearance="@style/errorText"
app:hintTextAppearance="@style/hintText">
<EditText
android:id="@+id/passwordInput"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/registration_hint_password"
android:inputType="textPassword"/>
</com.google.android.material.textfield.TextInputLayout>
код на языке котлин:
inputLayout.isErrorEnabled = true
inputLayout.setErrorTextColor(ColorStateList.valueOf(Color.RED))
inputLayout.error = ERROR MESSAGE
Вы можете изменить цвет фона, используя java для setError () динамически, как это
EditText.setError ("Your Error String"); EditText.setErrorColor (Color.parseColor ("# 000000"));
или EditText.setError ("Ваша строка ошибки"); EditText.setErrorColor (Color.BLUE);