Android:AppWidget 设计和布局
我想要一个像这个这样设计的AppWidget。
图片:
我已在网上搜索帮助,但找不到任何帮助。
特别: 我想要一个由图像按钮和将放置在其前面的文本视图组成的应用程序小部件(如上图所示)。
到目前为止,我找到的最接近的解决方案是通过relativeLayout,但它仍然没有将textView 放在imageButton上。
我们将很高兴获得任何有关设计此类 AppWidget 的帮助。
谢谢高级,加尔。
I would like to have an AppWidget that designed like this one.
Image:
I have searched the web for assitance, but couldn't find any.
Particularly:
I want an appwidget wich consist of an imageButton, and a textView that will be placed in front of it (like in the picture above).
The closest solution I have found so far is by relativeLayout but it still doesn't place the textView on the imageButton.
Will be happy to get any help for designing AppWidgets like that one.
Thanks Advanced, Gal.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用RelativeLayout 或FrameLayout。这些布局中的项目按照 XML 中读取的顺序添加,因此要使 TextView 位于 ImageView 的前面,只需先编写 ImageView,然后编写 TextView。
然后将这些小部件视图中的每一个嵌套到 GridLayout 中,以获得该 homeview 布局。
尝试查看布局下的 API 示例。里面有很好的例子。
You can use a RelativeLayout or a FrameLayout. The items in these layouts are added in the order read in XML, so to make your TextView sit infront of your ImageView, just write ImageView, then TextView.
Then nest each one of these widget views into a GridLayout, to get that homeview layout.
Try looking at the API Examples under layout. Good examples in there.
使用这个答案来解决它,(由alextsc在评论中链接)。
确实使用了相对布局,我通过使用以下配置成功地达到了预期的效果:
其中图像按钮是大图标,TextView 是小计数器图标。
希望它也能帮助你! =]
Used this answer to solve it, (Linked by alextsc in the comments).
A relative layout is indeed used, I managed to achieve the desired effect by using this configurations:
Where the image button is the big icon, and the TextView is the little counter icon.
Hope it will help you too! =]