Created
August 30, 2017 02:23
-
-
Save brucetoo/573a5f5b92d6b98dde9805ec4576ef6e to your computer and use it in GitHub Desktop.
custom toast show time(not really precise)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final Toast toast = new Toast(getContext()); | |
toast.setDuration(Toast.LENGTH_SHORT); | |
toast.setGravity(Gravity.TOP | Gravity.FILL_HORIZONTAL, 0, 0); | |
View view = LayoutInflater.from(getContext()).inflate(R.layout.layout_game_guide_25, null); | |
((TextView) view.findViewById(R.id.txt_hint)).setText(getResources().getText(R.string.game_tool_n_phone_permission_hint)); | |
toast.setView(view); | |
CountDownTimer toastCountDown = new CountDownTimer(5000, 1000 ) { | |
public void onTick(long millisUntilFinished) { | |
toast.show(); | |
} | |
public void onFinish() { | |
toast.cancel(); | |
} | |
}; | |
toast.show(); | |
toastCountDown.start(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment