2015-12-23 95 views
12

在我的應用程序中,我使用了Android Activity Slide轉換。我跟着a nice tutorial和預期一切正常,除了我EditText的提示,其中包含一個InputTextLayout內:EditText在轉換時提示visibile

<android.support.design.widget.TextInputLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_margin="@dimen/activity_vertical_margin"> 

    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:hint="Your name"/> 
</android.support.design.widget.TextInputLayout> 

所有的元器件都很好的動畫,但暗示動畫開始前剛剛彈出,並保持在最終的位置。我是否還需要添加一些額外的代碼來告訴框架爲這個提示設置動畫呢?

根據the Android developer documentation它應該工作(或至少它不是不受支持)。

我正在使用支持設計庫的22.2版本。

如果有人能指出我正確的方向,那將是很棒的。

+0

注意到Android 5.1.1和Support Library版本23.1.1仍然如此。任何人都找到解決方案? –

+0

不是我。 Sry基因。 :/ – Morosko

+1

這是一個#bug。 –

回答

1

這是一個錯誤。我一直在尋找修復。我使用的解決方法是在動畫前將edittext的提示設置爲空,並在動畫完成後設置edittext提示。但我不知道如果那是你想要做的。

+1

這是一個解決方法,但在材料設計指導意義上也不是很好的動畫效果,我認爲我們必須等待官方的修復程序 – Morosko

8

嘗試這種解決方案,它爲我工作:

當你有> 1個TextInputLayouts,把TextInputLayouts放入容器

inputTextPanel : LinearLayout 
    TextInputLayout 
    login : EditText 
    TextInputLayout 
    password : EditText 

和onCreateView:

setContentView(R.layout.login_layout) 
configuration(fromSdk = 21) { 
    inputTextPanel.isTransitionGroup = true 
} 

如果你有隻有一個,你可以只是

myTextInputLayout.isTransitionGroup = true 
+3

謝謝你提供了一個很好的解決方案。爲簡單起見,在xml中添加android:transitionGroup =「true」。只需添加到每個TextInputLayout以避免添加額外的LinearLayout嵌套。 – tylerjroach