久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

EditText Settext 不適用于片段

EditText Settext not working with Fragment(EditText Settext 不適用于片段)
本文介紹了EditText Settext 不適用于片段的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我有一個屏幕的 3 種狀態(tài)的片段;添加、編輯和查看.在添加中,我創(chuàng)建一個實體并保存它.下次我在查看模式下打開它并使用

I have fragments for 3 states of a screen; Add, Edit and View. In Add, I create an entity and save it. Next time I open it in View mode and set the entity name using

EditText entityName = (EditText) view.findViewById(R.id.entityName);    
entityName.setText(entity.getEntityname());

我從查看模式單擊編輯按鈕以打開編輯模式.我在這里更改實體名稱并保存.這讓我回到了視圖屏幕.但我發(fā)現(xiàn)實體名稱沒有更新.我調(diào)試并發(fā)現(xiàn) entity.getEntityname() 具有正確的值.我不確定為什么編輯文本沒有采用新值.

I click on the edit button from View mode to open the Edit mode. I change the entity name here and save it. This brings me back to the view screen. But I find the entity name is not updated. I debug and found that entity.getEntityname() is having correct value. I am not sure why the edit text does not take new value.

有什么想法嗎?

注意:我使用的是安卓 2.2 版

Note: I am using android version 2.2

推薦答案

EditText 似乎在重置 onCreateView 中的文本時出現(xiàn)問題.所以這里的解決方案是重置onResume中的文字.這行得通.

The EditText appears to have an issue with resetting text in onCreateView. So the solution here is to reset the text in onResume. This works.

onActivityCreated 也有問題.我在 onStart 中重置了 edittext 的內(nèi)容,它可以工作.[感謝@savepopulation]

Also there's an issue in onActivityCreated. I reset edittext's content in onStart and it works. [credits to @savepopulation]

這篇關(guān)于EditText Settext 不適用于片段的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

EditText: Disable Paste/Replace menu pop-up on Text Selection Handler click event(EditText:禁用文本選擇處理程序單擊事件上的粘貼/替換菜單彈出)
Multiline EditText with Done SoftInput Action Label on 2.3(2.3 上帶有完成 SoftInput 操作標簽的多行 EditText)
How to detect the swipe left or Right in Android?(如何在 Android 中檢測向左或向右滑動?)
Prevent dialog dismissal on screen rotation in Android(防止在Android中的屏幕旋轉(zhuǎn)對話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設置為僅接受 Android 中的數(shù)值?)
主站蜘蛛池模板: 91精品国产91久久久久久吃药 | 狠狠亚洲 | 日韩精品视频一区二区三区 | 中文一区二区 | 中文字幕亚洲欧美日韩在线不卡 | 色婷婷影院 | 中文字幕在线观看第一页 | 国产精品国产亚洲精品看不卡15 | 性高湖久久久久久久久 | 99久久久国产精品 | 国产一区二区在线视频 | 欧美日韩精品一区二区三区四区 | 在线中文字幕第一页 | 天堂一区| 九九久久精品 | 国产成人精品一区二区 | 日韩三级精品 | 亚洲一区二区久久 | 国产精品一区二区在线免费观看 | 欧美精选一区二区 | 午夜视频一区二区三区 | 国产视频二区 | 一级毛片视频 | 国产一区二区三区四区 | 国产成人免费视频网站高清观看视频 | 亚卅毛片 | 国产激情视频网站 | 久久精品国产a三级三级三级 | 免费看淫片 | 久久免费视频网 | 欧美日韩不卡在线 | 亚洲乱码国产乱码精品精的特点 | 波多野结衣一二三区 | 我要看免费一级毛片 | 日韩一区二区三区在线看 | 久久久不卡网国产精品一区 | 鲁大师一区影视 | 欧美国产日韩一区二区三区 | 在线观看中文字幕亚洲 | 中文字幕亚洲欧美日韩在线不卡 | 自拍偷拍小视频 |