Android - EditText hint not updating in soft keyboard screen

Viewed 61

enter image description here

The hint for my EditText when the soft keyboard is full screen mode is not reflecting the correct value after assigning a new value for hint to the EditText. Please see gif above.

Does anyone know how to resolve this? Below is isolated code to recreate this issue:

MainActivity.java

public class MainActivity extends AppCompatActivity {

    private ActivityMainBinding mBinding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mBinding = ActivityMainBinding.inflate(getLayoutInflater());
        setContentView(mBinding.getRoot());
    }

    public void onButtonClick(View v) {
        mBinding.barcodeEdittext.setHint("Some other Hint");
    }

}

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <EditText
        android:id="@+id/barcode_edittext"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Initial Hint" />

    <Button
        android:layout_width="200dp"
        android:layout_height="100dp"
        android:layout_gravity="center"
        android:text="Change Hint!"
        android:onClick="onButtonClick" />

</LinearLayout>
0 Answers
Related