Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Random Button Position Without Using an AbsoluteLayout

Random Button Position Without Using an AbsoluteLayout

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Random Button Position Without Using an AbsoluteLayout

Postby tehbrosta » Tue Jan 05, 2010 9:25 pm

The application I am building requires a button to be randomly placed on the screen. I can easily do this using an AbsoluteLayout, but it's not going to work properly on all devices.


Any suggestions?

Edit: Or could I use an AbsoluteLayout and use getWidth() & getHeight() to see what my canvas size is?
tehbrosta
Freshman
Freshman
 
Posts: 6
Joined: Tue Jan 05, 2010 9:15 pm

Top

Postby jwei512 » Wed Jan 06, 2010 12:09 am

Maybe you're looking for something like:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. WindowManager w = getWindowManager();
  3.  
  4. Display d = w.getDefaultDisplay();
  5.  
  6. int width = d.getWidth();
  7.  
  8. int height = d.getHeight();
  9.  
  10.  
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


Which will give you the size of the screen for each machine? In which case you can randomize where your button is programmatically using these dimensions.
- jwei

http://thinkandroid.wordpress.com
Examples, Code, and Tutorials
jwei512
Senior Developer
Senior Developer
 
Posts: 135
Joined: Mon Jul 27, 2009 9:35 pm
Location: Palo Alto, CA

Top

Return to View, Layout & Resource Problems

Who is online

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