I have an activity (be it Act.A), and it starts another activity (be it Act.B) which floats above Act.A, with the following style set:
In Act.B's onCreate(savedInstanceState):
requestWindowFeature(Window.FEATURE_NO_TITLE);
In styles.xml:
<style name="Theme.AppCompat.Light.NoTitle" parent="@style/Theme.AppCompat.Light">
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
In Act.B, there is a fragment which has an EditText. In the fragment's onActivityCreated, I show the soft keyboard using the following lines of code:
edittext.requestFocus();
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(edittext, 0);
Here is my xml for the EditText
<EditText
android:id="@+id/phone_number"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@null"
android:focusable="true"
android:focusableInTouchMode="true"
android:fontFamily="fonts/avenir-light.ttf"
android:hint="@string/sms_send_code_number_hint"
android:imeOptions="actionDone"
android:inputType="phone"
android:maxLines="1"
android:padding="5dp"
android:singleLine="true"
android:textColorHint="@color/sms_verification_edittext_grey"
android:textSize="16sp" />
The soft keyboard is shown, and the cursor is inside the edittext. Yet upon pressing keys on the soft keyboard, the edittext does not update immediately. Only after i dismiss the soft keyboard by pressing the Back button, would the edittext be updated with the correct text.
I also notice that other UI in the fragment does not update immediately when the keyboard is shown. Yet the UI would be updated when I dismiss the soft keyboard.
Any hints would be highly appreciated. thx in advance.