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

styling verticalPadding is not working properly in Android OS version 10 #134

Open
4 of 7 tasks
ratikanta131 opened this issue Apr 10, 2020 · 1 comment
Open
4 of 7 tasks

Comments

@ratikanta131
Copy link

Expected behaviour

styling > verticalPadding should adjust toast vertical padding. When make it 0, it should be 0.

Actual behaviour

Toast vertical padding not becoming 0.

I'm seeing this behaviour on

  • iOS device
  • iOS sim
  • Android device
  • Android sim

Hardware models

OnePlus 7T

OS versions

Android 10

I'm not a dummy, so I've checked these

  • It happens on a fresh Cordova CLI project as well.
  • I'm waiting for deviceready to fire.
  • My JavaScript has no errors (window.onerror catches nothing).

So how can we reproduce this?

Make styling > verticalPadding 0, see, still you will see some padding. I have checked in Android version 6, it is working fine.

Sweet ⭐⭐⭐⭐

this.toast.showWithOptions({ message, duration: 2000, position: 'bottom', addPixelsY: -160, styling: { opacity: 0.75, cornerRadius: 16, horizontalPadding: 10, verticalPadding: 5 } }).subscribe(() => {});

@gllqe
Copy link

gllqe commented Apr 6, 2021

        GradientDrawable shape = new GradientDrawable();
        shape.setCornerRadius(cornerRadius);
        shape.setAlpha((int)(opacity * 255)); // 0-255, where 0 is an invisible background
        shape.setColor(Color.parseColor(backgroundColor));
        // toast.getView().setBackground(shape);
        toast.getView().setBackgroundColor(Color.TRANSPARENT);

        final TextView toastTextView;
        toastTextView = (TextView) toast.getView().findViewById(android.R.id.message);
        toastTextView.setTextColor(Color.parseColor(textColor));
        if (textSize > -1) {
          toastTextView.setTextSize(textSize.floatValue());
        }
        toastTextView.setBackground(shape);
        toastTextView.setPadding(horizontalPadding, verticalPadding, horizontalPadding, verticalPadding);
        // toast.getView().setPadding(horizontalPadding, verticalPadding, horizontalPadding, verticalPadding);

        // this gives the toast a very subtle shadow on newer devices
        if (Build.VERSION.SDK_INT >= 21) {
          toastTextView.setElevation(6);
          // toast.getView().setElevation(6);
        }

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

2 participants