需要帮助为Android创造模拟世界时钟部件 [英] Need help creating analog world clock widget for Android

查看:250
本文介绍了需要帮助为Android创造模拟世界时钟部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要创建一个Android的世界时钟部件。它应该显示所选国家的时间,模拟时钟部件。

但我不知道如何更新窗口小部件视图的时间。

我试着用小部件配置活动。但它并不成功。请给我一些想法,做

我widget.xml文件包含以下内容: -

 <?XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android  机器人:ID =@ + ID /小工具
  机器人:layout_width =FILL_PARENT
  机器人:layout_height =FILL_PARENT
  机器人:layout_margin =8DIP
  机器人:背景=@绘制/ MyShape的>
< AnalogClock机器人:ID =@ + ID / AnalogClock
 机器人:layout_width =WRAP_CONTENT
 机器人:layout_height =WRAP_CONTENT
 机器人:拨打=@绘制/ widgetdial
 机器人:hand_hour =@绘制/ widgethour
 机器人:hand_minute =@绘制/ widgetminute/>
< / LinearLayout中>


解决方案

您可以看看在我的到位桶code:的 https://bitbucket.org/EmilYo/another_clock_widget
这是Android的一个数字时钟小工具( https://market.android.com/details ?ID = com.omgbutton.anotherclockwidget )。

I have to create an android world clock widget. It should show the selected country's time as an analog clock widget.

But I don't know how to update the time in the widget view.

I tried using the widget configuration activity. But it was not successful. Please give me some ideas for doing it

My widget.xml file contains the following:-

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

  android:id="@+id/Widget"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_margin="8dip"
  android:background="@drawable/myshape" >
<AnalogClock android:id="@+id/AnalogClock"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content"
 android:dial="@drawable/widgetdial" 
 android:hand_hour="@drawable/widgethour"
 android:hand_minute="@drawable/widgetminute"/>
</LinearLayout>

解决方案

You can look at my code on bitbucket: https://bitbucket.org/EmilYo/another_clock_widget It's a digital clock widget for android (https://market.android.com/details?id=com.omgbutton.anotherclockwidget).

这篇关于需要帮助为Android创造模拟世界时钟部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆