Skip to content Skip to sidebar Skip to footer

Android -- Is There A Way To Rotate A Toast 90 Degrees?

Can't think of any more info to provide. Is there a way?

Solution 1:

As hackbod said, you would have to have a custom view to display the toast.

I found a few classes for you that rotates the label for you: VerticalLabelView and CustomTextView

I chose to use the latter, and had this code working in my own app:

// Creating a new toast objectToastmyToast=newToast(MyActivity.this);
// Creating our custom text view, and setting text/rotationCustomTextViewtext=newCustomTextView(MyActivity.this);
text.SetText("Hello World!");
text.SetRotation(-90, 120, 90);
myToast.setView(text);
// Setting duration and displaying the toast
myToast.setDuration(Toast.LENGTH_SHORT);
myToast.show();

Solution 2:

Not an easy way. You can supply your own view to display the toast, so you can make a view that rotates its content.

Post a Comment for "Android -- Is There A Way To Rotate A Toast 90 Degrees?"