final Toast unlockMessage = Toast.makeText(getBaseContext(), "잠금이 해제됩니다.",Toast.LENGTH_SHORT);
unlockMessage.show();
new CountDownTimer(10000, 1000)
{
public void onTick(long millisUntilFinished) {unlockMessage.show();}
public void onFinish() {unlockMessage.show();}
}.start();
[ 인용 : http://stackoverflow.com/questions/2220560/can-an-android-toast-be-longer-than-toast-length-long ]
보통 Toast 메시지는
Toast.makeText(this, "YourMessage", Toast.LENGTH_SHORT).show();
이런식으로 되는데요
LENGTH_LONG 이 3.5초, LENGTH_SHORT가 2초 정도일거에요.
줄이거나 늘리고 싶으시다면 카운트다운타이머 함수를 이용하세요!
CountDownTimer(전체시간, 카운트 단위시간)
1000ms=1초 니까
저 코드는 10초동안 1초씩 줄어들며 카운트 다운되겠네요.
그리고 아래는 Toast를 직접 만들고 보여주고 끄는 식으로 작동을 시키고 있습니다.
'프로그래밍 > 앱프로그래밍' 카테고리의 다른 글
Google I/O 2017 Extended Seoul 짧은 소감 (0) | 2017.07.04 |
---|---|
안드로이드 강좌 - 액션바를 꾸며보자 (0) | 2016.01.31 |
안드로이드 강좌 1. 버튼에 이미지 넣기 #ImageButton (0) | 2016.01.30 |
앱이름 한글로 하기 (0) | 2016.01.30 |
안드로이드 스튜디오 강좌 - 유용한 단축키 (0) | 2016.01.29 |