val timeOut : LocalDate? = try {
LocalDate.parse(text, formatterList[0])
}catch (e: Exception){
try {
LocalDate.parse(text, formatterList[1])
}catch (e: Exception){
try {
LocalDate.parse(text, formatterList[2])
}catch (e: Exception){
null
}
}
}
bottomSheetDialog.window?.setDimAmount(0f) //除了bottomSheetDialog之外 alertDialog也可以用
alertDialog.window?.setClipToOutline(false) //有没有都差不多 alertDialog.window.apply { 這個才是重點,將alertDialog setLayout都變成match_parent this!!.setLayout( WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT ) }
android:inputType="textMultiLine" //允許使用者輸入多行文字,並自動支援換行 android:scrollbars="vertical" //當文字超過可見範圍時,自動顯示垂直捲動條 android:minLines="3" //預設最低高度為 3 行
在homework5中,輸入框改變後等三秒再顯示。如果用Thread.sleep就會不斷重覆等三秒,導致上一佪三秒完後顥示但我還在更改輸入
private var searchHandler = Handler(Looper.getMainLooper() ) //建立「排程器」 searchHandler.removeCallbacksAndMessages(null) //清除這個 Handler 之前所有排定的任務和訊息,避免重複執行 searchHandler.postDelayed({}, 3000) //在3 秒後,執行括號內的程式碼。
(如向上行就會向上加向下重覆做)
downAnim.repeatMode = Animation.REVERSE