如何把多个部件尺寸在一个APK? [英] How to put multiple widget sizes in one apk?

查看:140
本文介绍了如何把多个部件尺寸在一个APK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的是有不同的大小(即2×2,3×3,4×4等)于一体的apk和配置活动的时钟部件,以便能够选择要添加的大小。

What I'm trying to do is have a clock widget of different sizes (i.e. 2x2, 3x3, 4x4 etc) in one apk and a configuration activity to be able to select which size to add.

从我的文档教训:

  1. 的Widget大小指定与< appwidget提供者>在相应的XML文件中的标记
  2. 此外,在该文件中我设置配置活动的供应商

如此看来,大小是AppWidgetProvider的财产,我需要以某种方式创建从code在第一个配置活动的另外一个供应商... 还是我得到这个错误的,还有另一种方式?

So it seems that size is a property of AppWidgetProvider and I'll need to somehow create another provider from the code in configuration Activity of the first one... Or am I getting this wrong and there's another way?

这是可能的吗? :) 有人告诉我,一些小部件可以做到这一点:)

Is this possible at all? :) I've been told that some widgets can do this :)

在此先感谢!

P.S。我已阅读和的this 。第一个介绍了如何将多个wigets在一个APK,但目前还不清楚如何在运行时在它们之间进行选择。第二个是要改变的布局,而不是尺寸......

P.S. I have read this and this. First one explains how to put multiple wigets in one apk, but it's not clear how to select between them in runtime. Second one is about changing layouts, but not size...

推荐答案

你真的有在运行时要做到这一点?有可能在一个 .apk文件定义了几个小部件。

Do you really have to do this at runtime? It is possible to define several widgets in one .apk.

也许你可以有transdroid源看看吗?它们包括两种尺寸在同一个包一个小窗口的

Maybe you can have a look on transdroid source? They are including two sizes of a widget in the same package.

<一个href="http://$c$c.google.com/p/transdroid/source/browse/android/AndroidManifest.xml?spec=svn6a69442c758d5cd9814a200e6751c9c860dd8f0d&r=1de55ccfce7be9fbcef5a7c2e1f5a07fecae7830"相对=nofollow> AndroidManifest.xml中使用Transdroid

AndroidManifest.xml used by Transdroid

这篇关于如何把多个部件尺寸在一个APK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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