Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change the arrow? #134

Open
tiagago opened this issue Jun 21, 2018 · 3 comments
Open

How to change the arrow? #134

tiagago opened this issue Jun 21, 2018 · 3 comments

Comments

@tiagago
Copy link

tiagago commented Jun 21, 2018

Its possible change the arrow from spinner?

@rajshreetiwari
Copy link

rajshreetiwari commented Jan 7, 2019

@tiagago I had the similar issue, i tied using following code and it works properly, you can also try and check:-

In drawSelector() method, comment the Point code and use bitmap:-

  private void drawSelector(Canvas canvas, int posX, int posY) {
      if (isSelected || hasFocus()) {
         paint.setColor(highlightColor);
     } else {
        paint.setColor(isEnabled() ? arrowColor : disabledColor);
      }

  /* Point point1 = selectorPoints[0];
    Point point2 = selectorPoints[1];
    Point point3 = selectorPoints[2];

    point1.set(posX, posY);
    point2.set((int) (posX - (arrowSize)), posY);
    point3.set((int) (posX - (arrowSize / 2)), (int) (posY + (arrowSize / 2)));

    selectorPath.reset();
    selectorPath.moveTo(point1.x, point1.y);
    selectorPath.lineTo(point2.x, point2.y);
    selectorPath.lineTo(point3.x, point3.y);
    selectorPath.close();
    canvas.drawPath(selectorPath, paint);*/

    Resources res = getResources();
    Bitmap bitmap = BitmapFactory.decodeResource(res, R.drawable.arrow_down_green);
    canvas.drawBitmap(bitmap, posX - bitmap.getWidth(), posY - bitmap.getHeight(), paint);
}

Hope it may help you. :)

@princealirehman1
Copy link

@rajshreetiwari I can't find this drawSelector() after extending the class from MaterialSpinner.

How can i use this method ?

@princealirehman1
Copy link

@tiagago Did you find the solution to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants