有沒有辦法設置日期選擇器或時間選擇器上顯示的日期/時間,然後用戶可以編輯?我看了Android開發者控制檯,發現什麼都沒有,但我想知道是否還有一種方法?Android studio TimePicker和DatePicker
0
A
回答
1
當然,TimePicker
和DatePicker
類有適當的setters來設置所需的時間/日期後,你已經實例化它們。
例如:
final Calendar c = Calendar.getInstance();
hour = c.get(Calendar.HOUR_OF_DAY);
minute = c.get(Calendar.MINUTE);
timePicker1 = (TimePicker) findViewById(R.id.timePicker1); //supposed you have defined the "timePicker1" id in your layout xml
timePicker1.setCurrentHour(hour);
timePicker1.setCurrentMinute(minute);
+0
datepicker怎麼樣?我有timepicker工作,但不是datepicker,沒有設置日期的功能 –
+0
@ElliotArcher閱讀DatePicker api的init方法:http://developer.android.com/reference/android/widget/DatePicker.html – pleft
0
相關問題
- 1. Visual Studio Datepicker和Timepicker WP7
- 2. Android datepicker和timepicker問題
- 3. 結合DatePicker和TimePicker
- 4. 從的DatePicker和TimePicker
- 5. MVC Razor DatePicker和TimePicker
- 6. Android - 新的日曆樣式DatePicker和TimePicker
- 7. 克隆一個timepicker和datepicker
- 8. AppCompat DatePicker和TimePicker風格
- 9. UWP - DatePicker和TimePicker定製
- 10. DatePicker和TimePicker API <11
- 11. 從DatePicker和TimePicker獲取值
- 12. DatePicker和TimePicker更改值
- 13. Android NumberPicker,DatePicker,TimePicker箭頭丟失
- 14. 綁定單DATEVALUE到的DatePicker和TimePicker
- 15. 的DatePicker和TimePicker對話問題
- 16. 創建一個從的DatePicker和TimePicker
- 17. Datepicker和timepicker從一個對話框內
- 18. 一起使用silverlight datepicker和timepicker
- 19. 調整大小/縮小Android小部件(DatePicker和TimePicker)
- 20. 如何將datepicker string到timepicker?
- 21. DatePicker/Timepicker始終可見
- 22. WP7 DatePicker,TimePicker數據綁定
- 23. C#將DatePicker與TimePicker關聯
- 24. WP7中的DatePicker/TimePicker格式
- 25. 帶DatePicker的Timepicker插件
- 26. UWP TimePicker Visual Studio 2017
- 27. TimePicker Android
- 28. Android Timepicker
- 29. 你如何使用自定義Datepicker和Timepicker皮膚?
- 30. 在同一佈局中使用DatePicker和TimePicker
看看[這裏](https://開頭github上。 com/code-troopers/android-betterpickers)來自[這裏](http://stackoverflow.com/a/20223949/316555) –
是的。將選定的數據/時間存儲在「Calender」實例中,然後在用戶下次打開時將其設置爲日期/時間選擇器。 –