Accessibility Check fail when using TextInputLayout

后端 未结 4 1302
Happy的楠姐
Happy的楠姐 2021-01-12 02:32

I\'m using the new TextInputLayout provided by Android.support to do floating label. But it will fail Espresso Accessibility Check because \"View is missing speakable text n

4条回答
  •  不知归路
    2021-01-12 02:54

    You can make a TextView that has

    android:text="My Announcement For Edit Text"
    android:labelFor="@id/my_edit_text".
    

    Visibility = gone and visibility = invisible will make it so this label is not announced. Also if you set height and width to 0dp, this will not announce. Instead, constrain the view to be off the screen using something like:

    app:layout_constraintEnd_toStartOf="parent"

    So your textview will look like this:

    
    

提交回复
热议问题