What do margin values ​​for toast do?

The Android Toast class provides methods for getting and setting fields. I am sure that they refer to external fields for the whole toast. Since Toast messages float over the user interface, why are these fields necessary?

I tried to view the link to the SDK, and also search the Internet. The closest to the solution I found was one suggestion that both the fields and the offsets made it possible to control the positioning of the Toast. Why do I need two methods (albeit conceptually different, because the fields allow specification in terms of container width as a percentage) to control Toast positioning?

To be sure that these fields do not work, like a spacer for other layouts, right? That would not make sense, but I would like to be clear.

In general, I want to know why fields are needed, what fields and quotation marks for fields are compared to offsets, that is, when should I use fields, when should offsets be used, and why?

Update:

I have not yet been able to find the answers. I tried using fields compared to using offsets in code and found that they seem to offer two different Toast positioning paradigms. The purpose of the design (why two methods), when I have to use one method compared to the other (or at least examples when one of them was more useful than other developers / programmers) and even an exact operation (do margin " center "toast inside them" - these are the fields attached to the nearest edges of the container?) of these methods remain unclear.

Update 2:

, Toast.java, Google. , , Toast ( ?) . WindowManager.LayoutParams . , , AOSP, .

, .

+3
1

, , . setGravity(), , , , . , :

myToast.setMargin(10, 20);

, 10% , 20%

, , 10 20 :

myToast.setGravity(Gravity.LEFT| Gravity.TOP, 10, 20)
+6

All Articles