EditText editText = findViewById(R.id.edit_text); editText.setHintTextColor(Color.RED);
int color = ContextCompat.getColor(this, R.color.blue); EditText editText = findViewById(R.id.edit_text); editText.setHintTextColor(color);In this example, we use the ContextCompat class to get a color resource (in this case, we're getting a blue color). We then set the hint text color of an EditText view to this color. Package library: android.widget