android - Android AppWidgets 是否限于特定尺寸?

标签 android android-appwidget

我正在制作一个位于主屏幕上的 Android AppWidget。

用户的主屏空间很宝贵,所以希望widget小一点。理想的大小是 2x1 单元格。

有什么方法可以创建 2x1 小部件,还是我应该使用标准尺寸?

我的小部件改编自 Simple Wiktionary样本。

  • The manifestandroid:minWidth="146dip"android:minHeight="72dip"
  • a RelativeLayout with android:layout_width="fill_parent"android:layout_height="wrap_content"

我刚开始使用 Android,如果这是一个愚蠢的问题,请提前致歉。 :)

最佳答案

I'm just starting with Android, so apologies in advance if this is a silly question. :)

这绝对不是一个愚蠢的问题。

Does that refer to the available PhotoShop templates or is it a limitation of Android itself?

我的印象是 2x1 是合法尺寸,但我没有尝试过那种尺寸。

HTC have their own special implementation of the home screen, so maybe my widget will only work at 2x1 on HTC devices?

不同的主屏幕实现可能会以不同方式解释大小,但我希望它们大体上保持一致。

Is there any way to create a 2x1 widget, or should I use a standard size?

您可以试验较小的 android:minHeight 值,看看是否需要一个新的阈值来说服模拟器给您一个 2x1 的应用小部件。也就是说,使用 2x2 应用小部件可能会获得更一致的结果。

关于android - Android AppWidgets 是否限于特定尺寸?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3734944/

相关文章:

android - 是否可以在 appWidget 中放置带有 baseAdapter 的 GridView?

android - 检测 AppWidget 上的 OnTouch。如果可能的话?

android - App Widget 的不同 InfoWidget.xml

java - 服务内的广播接收器不工作

android - 如何将 flutter 的日期选择器值添加到文本字段?

android - 在响应式 CSS 中使用系统字体

android - 在 Android Studio 中为测试源使用 Kotlin 编译器选项

java - 低功耗蓝牙广告服务器 Android

android - 在不同的包名称下移动 AppWidgetProvider 会破坏 Activity 的小部件

安卓 : instumentation testing for app widgets