Aller au contenu
View in the app

A better way to browse. Learn more.

Forum de Frandroid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

taille de l'ecran

Featured Replies

Posté(e)

Bonjour!

Pour pouvoir placer mes widgets en fct de la taille de l'ecran j'ai écrit ce code pour déterminer respectivement la largeur et longueur de mon ecran :

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

layout=(LinearLayout)findViewById(R.id.layout);

int heigh=layout.getHeight();

int width=layout.getWidth();

Toast.makeText(this,String.valueOf(heigh)+""+String.valueOf(width),Toast.LENGTH_LONG).show();

}

malheureusemt ce code ne semble fonctionner car j'ai comme resultat 0 0

Est ce qq pourrait m'aider ?

Posté(e)

Bonjour!

Pour pouvoir placer mes widgets en fct de la taille de l'ecran j'ai écrit ce code pour déterminer respectivement la largeur et longueur de mon ecran :

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

layout=(LinearLayout)findViewById(R.id.layout);

int heigh=layout.getHeight();

int width=layout.getWidth();

Toast.makeText(this,String.valueOf(heigh)+""+String.valueOf(width),Toast.LENGTH_LONG).show();

}

malheureusemt ce code ne semble fonctionner car j'ai comme resultat 0 0

Est ce qq pourrait m'aider ?

Ton layout est il étendu sur toute la surface de ton écran ? (ie android:layout_width="fill_parent" android:layout_height="fill_parent").

Car si il est vide avec l'attribut wrap_content, c'est logique que ça renvoie 0.

Enfin c'est juste une idée.

Posté(e)
  • Auteur

mon layout s'étend sur tte la surface(fiil_parent sur height et width)

voila la solution ke g trouvé apès qq recherche:p

Display display = getWindowManager().getDefaultDisplay();

int width = display.getWidth();

int height = display.getHeight();

et ca fonctionne!!:P

Archivé

Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.

Account

Navigation

Rechercher

Rechercher

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.