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.

[résolu] Jauge circulaire

Featured Replies

Posté(e)

Bonjour, 

 

Je suis en train de développer une application et j'aurais aimé faire quelque chose de ce genre là:

 

post-44999-0-99724700-1374854437.jpg

 

C'est donc une espèce de jauge circulaire que je pourrais remplir en fonction d'un score (0-100).

 

J'ai littéralement cherché toute la journée sans résultat  :(

 

Si quelqu'un sait comment faire, n'hésitez pas.

Modifié par Ice

Posté(e)

Hello,

 

Je te conseille de regarder la documentation suivante:

- Bitmap:

https://developer.android.com/reference/android/graphics/Bitmap.html

- Canvas:

https://developer.android.com/reference/android/graphics/Canvas.html

- ArcShape:

https://developer.android.com/reference/android/graphics/drawable/shapes/ArcShape.html#ArcShape(float,%20float)

 

L'idée étant de créer un Bitmap, puis un canvas et enfin dessiner dedans à l'aide de la class ArcShape.

 

Nhdzq

Posté(e)
  • Auteur

Ah merci, je me suis un peu écarté de ce que tu m'as dit mais tu m'as mis sur la voie  :D

 
@Override
protected void onDraw(Canvas canvas) {
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG );
    //Grey
    paint.setARGB(255,153,153,153);
    canvas.drawCircle(70,70,70,paint);
    //Green
    paint.setARGB(255,0,153,0);
    //                       X Y  W   H
    canvas.drawArc(new RectF(0,0,140,140), 90, scoreToDegree(), true, paint);
    paint.setColor(Color.DKGRAY);
    canvas.drawCircle(70,70,60, paint);
}

Modifié par Ice

Rejoignez la conversation

Vous pouvez poster maintenant et vous enregistrez plus tard. Si vous avez un compte, connectez-vous maintenant pour poster.

Invité
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Répondre à ce sujet…

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.