如何滚动aglass活动现场证 [英] how to scroll live cards in aglass activity

查看:188
本文介绍了如何滚动aglass活动现场证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个应用程序的玻璃

I'm writing a glass app.

在一个活动我要几张牌(这在我的Andr​​oid应用程序的弹出窗口)。

In one activity I want to scroll between few cards (which were popups in my android app).

1)我想用cardsScrollView。

1) I thought to use cardsScrollView.

问题:是否有可能customView设置为一个卡对象

problem: Is it possible to set customView to a card object?

2)我想用LiveCard

2) I thought to use LiveCard

问题:

是否有可能把它们发布我的应用程序里,而不是在时间轴?

Is it possible to publish them inside my app and not in the timeline?

时有一个相当于LiveCardsScrollView?

Is there an equivalent LiveCardsScrollView?

任何其他的想法如何实现这一点?

Any other idea how to implement this?

推荐答案

从谷歌的样本code =htt​​ps://developers.google.com/glass/develop/gdk/ui/theme-小部件相对=nofollow> https://developers.google.com/glass/develop/gdk/ui/theme-widgets 和API文档的<一个href=\"https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/widget/CardScrollView\" rel=\"nofollow\">https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/widget/CardScrollView和<一个href=\"https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/widget/CardScrollAdapter\" rel=\"nofollow\">https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/widget/CardScrollAdapter,看来你1)是可能的,因为:

From Google's sample code at https://developers.google.com/glass/develop/gdk/ui/theme-widgets and API documentation at https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/widget/CardScrollView and https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/widget/CardScrollAdapter, it seems your 1) is possible, because:

1)CardScrollAdapter的方法公共查看getView(INT位置,查看convertView,父母的ViewGroup)返回查看(不卡);

1) The CardScrollAdapter's method public View getView(int position, View convertView, ViewGroup parent) returns a View (not a Card);

2)CardScrollView的获取方法也返回一个视图或对象,而不是专卡;

2) CardScrollView's get methods also return a View or Object, not Card specifically;

3)您可以替换私人列表&LT;卡&GT; mCards; 样品code(以上链接#1)私人列表&LT;&MyView的GT; mViews;

3) You can replace private List<Card> mCards; in the sample code (link #1 above) with private List<MyView> mViews;

但在这些链接的文档也使用卡作为示例,并且字卡似乎是指静态卡。因此,必须进行测试,以找到肯定。然而,有链路#1,说一份声明中你可以自己建立一个标准视图层次,或者使用卡类。,这表明它可以使用自定义视图。

But the documentation at those links also use Card as example, and the word cards seem to refer to static cards. So will have to test to find out for sure. However, there's a statement in link #1 that says "You can build a standard view hierarchy yourself or use the Card class.", suggesting it's possible to use a custom view.

我会回来跟你在12小时内后,我与我的玻璃今晚测试。

I'll get back with you within 12 hours after I test with my Glass tonight.

至于你的问题2,答案是肯定的 - 你发布的滚动内容的应用程序内,而不是在时间线上。您可以启动该活动(如在谷歌的链接#1的样品code)从菜单项选择,菜单连接到您的livecard。那么滚动视图内,你只能刷卡左,右看其他卡(或者自定义视图)在滚动视图,而不是时间表。你必须向下滑动,退出活动(浸泡)回到livecard,那么你可以刷卡左,右,看到了时间表。注意滚动视图是不喜欢静态的卡片,绝不会在时间线中显示。还要注意的是滚动视图内,您可以使用GestureDetector捕获其他手势(除了刷卡左,右,下)。

As for your question 2, the answer is yes - you publish the scrollable content inside your app and not in the timeline. You can launch the activity (as in the sample code in Google's link #1) from a menu item selection, and the menu is attached to your livecard. Then inside that scrolling view, you can only swipe left and right to see other cards (or maybe custom views) in the scrolling view, but not the timeline. You have to swipe down to exit the activity (immersion) to go back to livecard, then you can swipe left and right and see the timeline. Note the scrolling view is not like static cards and will never show in the timeline. Also note that inside the scrolling view, you may use GestureDetector to capture other gestures (besides swipe left and right and down).

刚刚确认:自定义视图可以添加到CardScrollView!我用扩展的FrameLayout和膨胀的布局xml文件的视图,并添加三个这样的看法CardScrollView。它工作得很好!

Just confirmed: custom views can be added to CardScrollView! I used a view that extends FrameLayout and inflates a layout xml file, and added three such views to CardScrollView. It works nicely!

也尝试添加,做画布绘制自定义视图,但一直没能看到在滚动视图中显示它。会尝试更晚。

Also tried to add a custom view that does the Canvas drawing, but haven't been able to see it shown in the scrolling view. Will try more later.

刚刚测试过,发现您可以添加任何意见向CardScrollView - 我能4自定义视图添加到滚动视图:一个静态卡,一种观点与绘图画布,一用的OpenGL ES 1.0绘图,最后一节与OpenGL ES 2.0的图形。这是好事,知道给我!谢谢你的问题。

Just tested and found you can add any views to the CardScrollView - I'm able to add 4 custom views to a scrollview: one static Card, one view with Canvas drawing, one with OpenGL ES 1.0 drawing, and the final one with OpenGL ES 2.0 drawing. This is good to know to me! Thanks for your question.

这篇关于如何滚动aglass活动现场证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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