Toast specific location

Put your problem here if it does not fit any of the other categories.

Toast specific location

Postby corem » Mon Feb 25, 2008 10:28 am

Hi,
I'd like to ask if there is any way to position a Toast to a specific location on the screen?
I know about gravity, but it is not enough. I've tried to set margins but it doesn't work.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.   Toast toast = Toast.makeText(MyActivity.this, "Hi", Toast.LENGTH_SHORT);
  3.  
  4.   toast.setGravity(Gravity.TOP);
  5.  
  6.   toast.setMargin(50, 20);
  7.  
  8.   toast.show();
  9.  
  10.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

Any help will be appreciated.
Corem.
corem
Freshman
Freshman
 
Posts: 3
Joined: Mon Feb 25, 2008 10:11 am

Top

Re: Toast specific location

Postby Misiu » Mon Feb 25, 2008 2:57 pm

corem wrote:Hi,
I'd like to ask if there is any way to position a Toast to a specific location on the screen?
I know about gravity, but it is not enough. I've tried to set margins but it doesn't work.
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.   Toast toast = Toast.makeText(MyActivity.this, "Hi", Toast.LENGTH_SHORT);
  2.   toast.setGravity(Gravity.TOP);
  3.   toast.setMargin(50, 20);
  4.   toast.show();
  5.  
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

Any help will be appreciated.
Corem.
Misiu
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Feb 25, 2008 12:09 pm

Postby rmeph » Tue Feb 26, 2008 8:59 am

see that example

http://code.google.com/android/samples/ ... ssage.html

may be it's help for u..........
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Postby corem » Tue Feb 26, 2008 12:53 pm

Thank you. I've tried that with the View also. Unfortunately it doesn't work.
corem
Freshman
Freshman
 
Posts: 3
Joined: Mon Feb 25, 2008 10:11 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 21 guests