【问题标题】:Android -- Is there a way to rotate a toast 90 degrees?Android -- 有没有办法将吐司旋转 90 度?
【发布时间】:2011-09-08 05:37:00
【问题描述】:

想不出更多信息可以提供。有什么办法吗?

【问题讨论】:

    标签: android user-interface


    【解决方案1】:

    正如 hackbod 所说,您必须有一个自定义视图来显示 toast。

    我为您找到了一些为您旋转标签的类:VerticalLabelViewCustomTextView

    我选择使用后者,并让这段代码在我自己的应用程序中运行:

    // Creating a new toast object
    Toast myToast = new Toast(MyActivity.this);
    // Creating our custom text view, and setting text/rotation
    CustomTextView text = new CustomTextView(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();
    

    【讨论】:

      【解决方案2】:

      不是一个简单的方法。您可以提供自己的视图来显示 toast,这样您就可以创建一个旋转其内容的视图。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-05-23
        • 2013-09-15
        • 1970-01-01
        • 2012-04-06
        • 1970-01-01
        • 2011-02-27
        • 2020-09-11
        • 1970-01-01
        相关资源
        最近更新 更多