Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> android sdk wymiary
nospor
post
Post #1





Grupa: Moderatorzy
Postów: 36 559
Pomógł: 6315
Dołączył: 27.12.2004




Jak przy pomocy sdk pobrać wymiary telefonu/urządzenia?
Bo model czy wersje to nie problem
android.os.Build.MODEL
ale nie znalazłem/przeoczyłem tam gdzieś info wymiarach urządzenia. Jest coś takiego?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
pedro84
post
Post #2





Grupa: Nieautoryzowani
Postów: 2 249
Pomógł: 305
Dołączył: 2.10.2006

Ostrzeżenie: (0%)
-----


Dwa snippety z neta, powinny śmigać na 8 z tego co ludzie piszą - sorry, nie testowałem:
Kod
var disp = WindowManager.DefaultDisplay;
var height = disp.Height;
var width = disp.Width;

Console.WriteLine("Default Display: {0}x{1}", width, height);

var met = new DisplayMetrics();

disp.GetMetrics(met);


var heightm = met.HeightPixels;
var widthm = met.WidthPixels;

Console.WriteLine("Metrics: {0}x{1}", widthm, heightm);
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 16.10.2025 - 20:43