title: Custom TextInputLayout does not show in preview
body: <p>I have custom textinputlayout in my login activity 
  also in custom textinputlayout layout i have custom clearable edittext. </p>
  
  <p>I can't see my custom textinputlayout in my login activity screen's preview but it's shown when i run the app on device.</p>
  
  <p>Login Activity's xml</p>
  
  <pre><code>            &lt;com.santsg.paximum.ui.customview.component.SpecialTextInputLayout
                  android:id="@+id/userNameEdt"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  app:sethint="@string/user_name"/&gt;
  
              &lt;com.santsg.paximum.ui.customview.component.SpecialTextInputLayout
                  android:id="@+id/passwordEdt"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  app:sethint="@string/password"/&gt;
  </code></pre>
  
  <p>CustomTextInputLayout</p>
  
  <pre><code>public class SpecialTextInputLayout extends LinearLayout {
  
  ClearableEditText editText;
  TextInputLayout layout;
  String hint;
  public SpecialTextInputLayout(Context context) {
      this(context, null);
  }
  
  public SpecialTextInputLayout(Context context, AttributeSet attrs) {
      this(context, attrs, 0);
  }
  
  public SpecialTextInputLayout(Context context, AttributeSet attrs, int defStyleAttr) {
      super(context, attrs);
      LayoutInflater.from(getContext()).inflate(R.layout.special_edittext_layout, this);
      initResource();
  
      TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.ClearableEditText, defStyleAttr, 0);
      try {
          hint = ta.getString(R.styleable.ClearableEditText_sethint);
      } finally {
          ta.recycle();
      }
  
      layout.setHint(hint);
  }
  
  private void initResource() {
      editText = findViewById(R.id.specialEdt);
      layout = findViewById(R.id.specialEditLayout);
  }
  
  public void setText(String text) {
      editText.setText(text);
  }
  
  public String getText() {
      return editText.getText().toString();
  }
  </code></pre>
  
  <p>Custom text input layout's xml.</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;android.support.design.widget.TextInputLayout
      android:id="@+id/specialEditLayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:theme="@style/AppTheme.EditText.Input"&gt;
  
      &lt;com.santsg.paximum.ui.customview.component.ClearableEditText
          android:id="@+id/specialEdt"
          android:layout_width="match_parent"
          android:layout_height="@dimen/clearable_edittext_input_height"/&gt;
  
  &lt;/android.support.design.widget.TextInputLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>and clearable edittext which is in special/custom text input layout.</p>
  
  <pre><code>ublic class ClearableEditText extends AppCompatEditText implements View.OnTouchListener, View.OnFocusChangeListener, TextWatcher {
  
  private Drawable mClearTextIcon;
  private OnFocusChangeListener mOnFocusChangeListener;
  private OnTouchListener mOnTouchListener;
  
  public ClearableEditText(final Context context) {
      super(context);
      init(context);
  }
  
  public ClearableEditText(final Context context, final AttributeSet attrs) {
      super(context, attrs);
      init(context);
  }
  
  public ClearableEditText(final Context context, final AttributeSet attrs, final int defStyleAttr) {
      super(context, attrs, defStyleAttr);
      init(context);
  }
  
  @Override
  public void setOnFocusChangeListener(final OnFocusChangeListener onFocusChangeListener) {
      mOnFocusChangeListener = onFocusChangeListener;
  }
  
  @Override
  public void setOnTouchListener(final OnTouchListener onTouchListener) {
      mOnTouchListener = onTouchListener;
  }
  
  private void init(final Context context) {
      final Drawable drawable = ContextCompat.getDrawable(context, android.support.v7.appcompat.R.drawable.abc_ic_clear_material);
      final Drawable wrappedDrawable = DrawableCompat.wrap(drawable); //Wrap the drawable so that it can be tinted pre Lollipop
      DrawableCompat.setTint(wrappedDrawable, getCurrentHintTextColor());
      mClearTextIcon = wrappedDrawable;
      mClearTextIcon.setBounds(0, 0, mClearTextIcon.getIntrinsicHeight(), mClearTextIcon.getIntrinsicHeight());
      setClearIconVisible(false);
      super.setOnTouchListener(this);
      super.setOnFocusChangeListener(this);
      addTextChangedListener(this);
  }
  
  
  @Override
  public void onFocusChange(final View view, final boolean hasFocus) {
      if (hasFocus) {
          setClearIconVisible(getText().length() &gt; 0);
      } else {
          setClearIconVisible(false);
      }
      if (mOnFocusChangeListener != null) {
          mOnFocusChangeListener.onFocusChange(view, hasFocus);
      }
  }
  
  @Override
  public boolean onTouch(final View view, final MotionEvent motionEvent) {
      final int x = (int) motionEvent.getX();
      if (mClearTextIcon.isVisible() &amp;&amp; x &gt; getWidth() - getPaddingRight() - mClearTextIcon.getIntrinsicWidth()) {
          if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
              setError(null);
              setText("");
          }
          return true;
      }
      return mOnTouchListener != null &amp;&amp; mOnTouchListener.onTouch(view, motionEvent);
  }
  
  @Override
  public final void onTextChanged(final CharSequence s, final int start, final int before, final int count) {
      if (isFocused()) {
          setClearIconVisible(s.length() &gt; 0);
      }
  }
  
  @Override
  public void beforeTextChanged(CharSequence s, int start, int count, int after) {
  }
  
  @Override
  public void afterTextChanged(Editable s) {
  }
  
  
  private void setClearIconVisible(final boolean visible) {
      mClearTextIcon.setVisible(visible, false);
      final Drawable[] compoundDrawables = getCompoundDrawables();
      setCompoundDrawables(
              compoundDrawables[0],
              compoundDrawables[1],
              visible ? mClearTextIcon : null,
              compoundDrawables[3]);
  }
  </code></pre>