No speakable text present at Android Studio

When adding a field for entering a number(Number widget), the error “No speakable text present at Android Studio” takes off

content_main.xml: enter image description here activity_main.xml: enter image description here

Answers

1.The problem is you are missing content labeling for the view, you should add content description so the user could simply understand what data he should enter into the view

for example, if you want the user to enter the number of cookies he wants you should add a content description as seen below:

android:contentDescription="Enter How Much Cookies You Want"

You should also add an android:hint so the user would have it in front of them an example of the data you want inputted for example:

android:hint="e.g 5"

So your views XML code should look as follows

<EditText
    android:id="@+id/editTextNumber2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ems="10"
    android:inputType="number"
    android:minHeight="48dp"
    android:contentDescription="Enter How Much Cookies You Want" 
    android:hint="e.g 8" />
上一篇:什么是IS-IS中间系统到中间系统?网工、运维必看


下一篇:第六章上机实验报告