Created
October 2, 2015 09:49
-
-
Save h6ah4i/1d661ac9fc922a048211 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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