??如果想對(duì)EditText設(shè)置默認(rèn)值,在java代碼中使用setText函數(shù)是不行的,需要在layout文件中設(shè)置“text變量”,如下所示設(shè)置默認(rèn)值為“192.168.1.1”:文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-680363.html
<EditText
android:id="@+id/car1_ip_edit"
android:layout_width="160dp"
android:layout_height="50dp"
android:layout_marginLeft="-28dp"
android:layout_toRightOf="@id/car1_ip_text"
android:inputType="text"
android:text="192.168.1.1"
android:maxLength="20"
android:textColor="@color/black"
android:textSize="17sp" />
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-680363.html
到了這里,關(guān)于Android studio中EditText設(shè)置默認(rèn)值的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!