2017-09-26 56 views
1

我有一個可編輯的字段,在大多數設備上顯示鍵盤自動更正選項。但是,在Android 5.0.2的LG上,鍵盤在用戶輸入時不會顯示自動更正建議。其他應用程序如Whatsapp 顯示自動更正建議。 inputType屬性缺少什麼?爲什麼EditText在某些設備上不顯示自動完成/自動更正建議?

<EditText 
     android:id="@+id/user_input_edit" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:layout_weight="1" 
     android:fadeScrollbars="false" 
     android:hint="@string/global_footer_hint" 
     android:inputType="textMultiLine|textCapSentences|textAutoComplete|textAutoCorrect" 
     android:maxLength="@integer/post_max_len" 
     android:maxLines="4" 
     android:minLines="1" 
     android:scrollbars="vertical" 
     android:textColor="@color/white" 
     android:textColorHint="@color/grey_005" 
     android:textCursorDrawable="@null" 
     /> 

UPDATE:繼建議,我在https://gitlab.com/gradha/Stackoverflow46421849創建了一個樣本測試,有一些EditText窗口小部件,每一個簡單的應用程序有不同的設置。在大多數設備上,所有字段都顯示軟鍵盤的自動填充建議,但在此特定的舊版Android上,只有Nongthonbam Tonthoi建議的已棄用的autoText字段按預期工作。看起來這可能是一個實現錯誤。

+0

嘗試使用android:autoText =「true」 –

+0

試試這個mEditText.setInputType(InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE); – Ankita

+0

@NongthonbamTonthoi您可能想將該評論寫爲實際答案。 –

回答

1

嘗試增加:

android:autoText="true" 

EditText

但這可能不會在模擬器上工作。