2016-04-14 1 views
1

編集テキストの浮動の問題を解決するには誰でも助けてください。私の要件に応じて、エラーテキストが表示されたときにヒントテキストがeditbox自体に表示されます。今、何が、私はラベルも移動エラーテキストを表示するたびに、私はlabeluntilを移動すると、ユーザーがない限り、スクリーンショットは、Googleの設計画面から http://www.google.com/design/spec/components/text-fields.html#text-fields-single-line-text-field enter image description hereTextInputレイアウトは、ラベルを浮かべないでエラーを表示します

+0

foのデフォルトの動作で、コードをチェックしていますか? – Eenvincible

+0

私のXMLが追加されました。 – Bytecode

答えて

0
を取られた

の入力を開始しないことが起こっています

<android.support.design.widget.TextInputLayout 
     android:id="@+id/ti_keyword_error" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 

     android:layout_marginLeft="@dimen/defaultLayoutPadding" 
     android:layout_marginRight="@dimen/defaultLayoutPadding" 
     android:layout_marginTop="@dimen/adv_top_padding"> 

     <android.support.v7.widget.AppCompatEditText 
      android:id="@+id/et_keyword_search" 
      style="@style/match_wrap.white_hint.no_focusable" 
      android:textColorHint="@color/color_white" 
      android:hint="@string/m_adv_keyskills" /> 


    </android.support.design.widget.TextInputLayout> 

私はこれはあなたのxmlファイルを共有することができTextInputLayout

final boolean hasText = mEditText != null && !TextUtils.isEmpty(mEditText.getText()); 
     final boolean isFocused = arrayContains(getDrawableState(), android.R.attr.state_focused); 
     final boolean isErrorShowing = !TextUtils.isEmpty(getError()); 

     if (mDefaultTextColor != null) { 
      mCollapsingTextHelper.setExpandedTextColor(mDefaultTextColor.getDefaultColor()); 
     } 

     if (mCounterOverflowed && mCounterView != null) { 
      mCollapsingTextHelper.setCollapsedTextColor(mCounterView.getCurrentTextColor()); 
     } else if (isErrorShowing && mErrorView != null) { 
      mCollapsingTextHelper.setCollapsedTextColor(mErrorView.getCurrentTextColor()); 
     } else if (isFocused && mFocusedTextColor != null) { 
      mCollapsingTextHelper.setCollapsedTextColor(mFocusedTextColor.getDefaultColor()); 
     } else if (mDefaultTextColor != null) { 
      mCollapsingTextHelper.setCollapsedTextColor(mDefaultTextColor.getDefaultColor()); 
     } 

     if (hasText || isFocused || isErrorShowing) { 
      // We should be showing the label so do so if it isn't already 
      collapseHint(animate); 
     } else { 
      // We should not be showing the label so hide it 


     expandHint(animate); 
    }