Skip to content

Instantly share code, notes, and snippets.

@h6ah4i
Created October 2, 2015 09:49
Show Gist options
  • Save h6ah4i/1d661ac9fc922a048211 to your computer and use it in GitHub Desktop.
Save h6ah4i/1d661ac9fc922a048211 to your computer and use it in GitHub Desktop.
package com.comolib.client.utils.workaround;
import android.content.Context;
import android.graphics.Color;
import android.support.design.widget.TextInputLayout;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
public class WorkaroundTextInputLayout extends TextInputLayout {
public WorkaroundTextInputLayout(Context context) {
super(context);
}
public WorkaroundTextInputLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public WorkaroundTextInputLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
super.addView(child, index, params);
// Need to set the hint text to EditText with transparent color because
// it will be shown when EditText in full screen mode (landscape screen).
if (child instanceof EditText) {
EditText editText = (EditText) child;
editText.setHintTextColor(Color.TRANSPARENT);
editText.setHint(getHint());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment