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

EditText Settext 不適用于片段

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

問題描述

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

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());

我從查看模式單擊編輯按鈕以打開編輯模式.我在這里更改實體名稱并保存.這讓我回到了視圖屏幕.但我發現實體名稱沒有更新.我調試并發現 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 中的文本時出現問題.所以這里的解決方案是重置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 的內容,它可以工作.[感謝@savepopulation]

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

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

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

相關文檔推薦

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中的屏幕旋轉對話框解除)
How do I handle ImeOptions#39; done button click?(如何處理 ImeOptions 的完成按鈕點擊?)
How do you set EditText to only accept numeric values in Android?(您如何將 EditText 設置為僅接受 Android 中的數值?)
主站蜘蛛池模板: 成人精品一区二区户外勾搭野战 | 国产日韩欧美一区二区 | 婷婷综合在线 | 日韩中文字幕一区二区 | 午夜免费观看体验区 | 欧美一区二区 | 国产成人综合在线 | 精品少妇一区二区三区日产乱码 | 孰女乱色一区二区三区 | 久久久精品网站 | 久久久这里只有17精品 | 精品久久久久久久久久 | 在线免费视频一区 | 久久综合久久综合久久 | 亚洲精品日韩精品 | www.玖玖玖 | www.国产精| 久久99精品久久久久久国产越南 | 亚洲天堂日韩精品 | 亚洲九九 | 久久免费观看视频 | 成人在线一区二区 | aaaaa毛片| 亚洲一页 | 四虎影视一区二区 | 精品国产一区二区在线 | 精品一二区 | 午夜电影网 | 天天艹天天干天天 | 九九亚洲精品 | 亚洲精品在线观看网站 | 欧美日本韩国一区二区三区 | 激情五月综合网 | 在线观看中文视频 | 欧日韩不卡在线视频 | 欧美日韩不卡合集视频 | 视频1区 | 午夜精品视频 | 欧美成人一级视频 | 在线观看亚洲专区 | 亚洲免费视频一区 |