【问题标题】:Set timezone for TextClock with RemoteViews使用 RemoteViews 为 TextClock 设置时区
【发布时间】:2017-03-05 07:08:52
【问题描述】:

我开发了一个小部件应用程序。每个小部件都有一个TextClock,我想为每个文本时钟设置时区,但RemoteViews 不支持设置时区。

如何设置时区?

【问题讨论】:

    标签: android timezone remoteview


    【解决方案1】:

    使用RemoteViewssetString 方法,您可以调用TextClocksetTimeZone 方法。例如:

    RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.appwidget);
    views.setString(R.id.textClock, "setTimeZone", "Europe/Zurich");
    

    这假定R.layout.appwidget 布局包含一个ID 为R.id.textClockTestClock 视图。

    【讨论】:

      猜你喜欢
      • 2013-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-04
      • 2022-12-24
      • 2011-12-13
      • 2020-06-12
      相关资源
      最近更新 更多