개발로 개발해
Toast Class 본문
Toast Temp= Toast.makeText(getApplicationContext(), "출력할 내용", Toast. LENGTH_SHORT);
Temp.show();
1번째 : Context
2번째 : 출력 내용
3번째 : 보여지는 시간
Toast.LENGTH_LONG : 토스트를 길게 보여주고 싶을 때 사용
Toast.LENGTH_SHORT : 토스트를 짧게 보여주고 싶을 때 사용
추가적인것들
Public methods | |
---|---|
void | cancel() Close the view if it's showing, or don't show it if it isn't showing yet. |
int | getDuration() Return the duration. |
int | getGravity() Get the location at which the notification should appear on the screen. |
float | getHorizontalMargin() Return the horizontal margin. |
float | getVerticalMargin() Return the vertical margin. |
View | getView() Return the view. |
int | getXOffset() Return the X offset in pixels to apply to the gravity's location. |
int | getYOffset() Return the Y offset in pixels to apply to the gravity's location. |
static Toast | makeText(Context context, Make a standard toast that just contains a text view with the text from a resource. |
static Toast | makeText(Context context, Make a standard toast that just contains a text view. |
void | setDuration(int duration) Set how long to show the view for. |
void | setGravity(int gravity, Set the location at which the notification should appear on the screen. |
void | setMargin(float horizontalMargin, Set the margins of the view. |
void | setText(int resId) Update the text in a Toast that was previously created using one of the makeText() methods. |
void | setText(CharSequence s) Update the text in a Toast that was previously created using one of the makeText() methods. |
void | setView(View view) Set the view to show. |
void | show() Show the view for the specified duration. |
'android' 카테고리의 다른 글
아이콘 변경 사이트 (0) | 2018.07.08 |
---|---|
setContentView (0) | 2018.07.06 |
안드로이드 Context (0) | 2018.07.06 |