-4
私はトーストテキストをランダムに電話画面に表示するコードをテストしています。 Toast Gravityのxとyオフセットの最大値はどれくらいですか?Toast.setGravityのx、yオフセットの範囲はどれくらいですか?
int i=0;
while(i < 100){
Random rand = new Random();
int xOffset = rand.nextInt(500); //what is the max number for this?
int yOffset = rand.nextInt(700); //what is the max number for this?
Context context = getApplicationContext();
CharSequence text = "Hello toast!";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.setGravity(Gravity.TOP|Gravity.LEFT,xOffset,yOffset);
toast.show();
i++;
}