Notice
Recent Posts
Recent Comments
Link
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
Archives
Today
Total
관리 메뉴

개발로 개발해

Toast Class 본문

android

Toast Class

Dev_JS 2018. 7. 6. 11:41


Toast Temp= Toast.makeText(getApplicationContext(), "출력할 내용", Toast. LENGTH_SHORT);

Temp.show();

1번째  : Context

2번째  : 출력 내용

3번째  : 보여지는 시간

Toast.LENGTH_LONG : 토스트를 길게 보여주고 싶을 때 사용

Toast.LENGTH_SHORT : 토스트를 짧게 보여주고 싶을 때 사용


추가적인것들

Public methods

voidcancel()

Close the view if it's showing, or don't show it if it isn't showing yet.

intgetDuration()

Return the duration.

intgetGravity()

Get the location at which the notification should appear on the screen.

floatgetHorizontalMargin()

Return the horizontal margin.

floatgetVerticalMargin()

Return the vertical margin.

ViewgetView()

Return the view.

intgetXOffset()

Return the X offset in pixels to apply to the gravity's location.

intgetYOffset()

Return the Y offset in pixels to apply to the gravity's location.

static ToastmakeText(Context context, int resId, int duration)

Make a standard toast that just contains a text view with the text from a resource.

static ToastmakeText(Context context, CharSequence text, int duration)

Make a standard toast that just contains a text view.

voidsetDuration(int duration)

Set how long to show the view for.

voidsetGravity(int gravity, int xOffset, int yOffset)

Set the location at which the notification should appear on the screen.

voidsetMargin(float horizontalMargin, float verticalMargin)

Set the margins of the view.

voidsetText(int resId)

Update the text in a Toast that was previously created using one of the makeText() methods.

voidsetText(CharSequence s)

Update the text in a Toast that was previously created using one of the makeText() methods.

voidsetView(View view)

Set the view to show.

voidshow()

Show the view for the specified duration.







'android' 카테고리의 다른 글

아이콘 변경 사이트  (0) 2018.07.08
setContentView  (0) 2018.07.06
안드로이드 Context  (0) 2018.07.06
Comments