当 EditText 控件的 inputType 为 number 时,如何以编程方式为其设置文本?
<EditText
android:id="@+id/WorkingHoursET"
android:layout_width="fill_parent"
android:textColor="@color/white"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/WorkingHoursTV"
android:layout_below="@+id/WorkingHoursTV"
android:layout_marginTop="14dp"
android:ems="10"
android:inputType="number" />
EditText workedHours = (EditText)findViewById(R.id.WorkedHoursET);
workedHours.setText(8); //this is not working
workedHours.setText("8"); //neither this