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.

probleme changment du couleur du crayon

Featured Replies

Posté(e)

bonjour a tous ,

mon probleme est que a chaque fois que je choisie une couleur tous les ecriture sur l'ecran modifier de meme couleur .je veut que si je choisie une autre couleur les couleurs de graphics precedent ne soit pas modifier .

merci

public class Dessineretcolorer extends Activity{

private Paint paint= new Paint();

private Path path= new Path();

int tool;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(new graph(this,null));

}

@Override

public boolean onCreateOptionsMenu(Menu menu) {

SubMenu m =menu.addSubMenu(0, 0, 0, "crayons");

m.setIcon(R.drawable.jaune);

m.setHeaderIcon(R.drawable.jaune);

m.add(0, 1, 0, "noir");

m.add(0, 2, 0, "bleu");

m.add(0, 3, 0, "rouge");

m.add(0, 4, 0, "vert");

m.add(0, 5, 0, "effacer l'ecran");

return super.onCreateOptionsMenu(menu);

}

@Override

public boolean onOptionsItemSelected(MenuItem item) {

switch(item.getItemId())

{

case 1:

paint.setColor(Color.BLACK);

break;

case 2:

paint.setColor(Color.BLUE);

path.set(path);

break;

case 3:

paint.setColor(Color.RED);

path.set(path);

break;

case 4:

paint.setColor(Color.GREEN);

path.set(path);

break;

case 5:

paint.setColor(Color.WHITE);

break;

}

return super.onOptionsItemSelected(item);

}

public class graph extends View {

public graph(Context context, AttributeSet attrs) {

super(context, attrs);

paint.setAntiAlias(true);

paint.setStrokeWidth(2f);

paint.setColor(Color.BLACK);

paint.setStyle(Paint.Style.STROKE);

paint.setStrokeJoin(Paint.Join.BEVEL);

}

@Override

protected void onDraw(Canvas c) {

c.drawColor(Color.WHITE);

c.drawPath(path, paint);

c.drawText("couleur vert",70, 80, paint);

c.drawCircle(150, 150,50 , paint);

c.drawText("couleur bleu",200, 200, paint);

c.drawCircle(300, 300,50 , paint);

c.drawText("couleur rouge",350, 400, paint);

c.drawRect(100,350,400,400, paint);

}

public boolean onTouchEvent(MotionEvent event) {

float eventX = event.getX();

float eventY = event.getY();

switch (event.getAction()) {

case MotionEvent.ACTION_DOWN:

path.moveTo(eventX, eventY);

return true;

case MotionEvent.ACTION_MOVE:

path.lineTo(eventX, eventY);

break;

case MotionEvent.ACTION_UP:

break;

default:

return false;

}

// Schedules a repaint.

invalidate();

return true;

}

}

}

j'ai besoin de votre aide svp

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.