ActionBarSherlock当检测到Chromecast设

ActionBarSherlock当检测到Chromecast设

本文介绍了MediaRouter:使用ActionBarSherlock当检测到Chromecast设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我修改了Mediarouter源依赖于ActionBarSherlock,而不是应用程序兼容性。但是,从现在的MediaRouteAdapter回调 onDeviceAvailable(...)不会被调用。

So I modified the Mediarouter source to be dependent on ActionBarSherlock rather than AppCompat. However, now the callback from MediaRouteAdapter onDeviceAvailable(...) is not being called.

如何得到任何想法这个工作?

Any ideas on how to get this to work?

我不想离开剧组按钮始终可见。相反,我想用 onDeviceAvailable(..)仅使其可见当一个设备是可用的。

I don't want to leave the cast button always visible. Rather, I want to use onDeviceAvailable(..) to only make it visible when a device is available.

推荐答案

我发现了如何解决这个黑客攻击。

I found a hack on how to fix this.

如果您使用的应用程序兼容性,当你有一个Chromecast设备在网络中,根据您的实施 onDeviceAvailable(...)的投射图标才可以看到

If you use appcompat, the cast icon will only be visible when you have a chromecast device in your network, based upon your implementation of onDeviceAvailable(...).

不过,如果你使用ABS,不叫 onDeviceAvailable(...)方法时Chromecast的设备在网络上可用。因此,为了看到投射图标,我们必须将它设置为始终可见。

However, if you use ABS, the onDeviceAvailable(...) method is not called when a chromecast device is available on the network. So in order to see the cast icon, we must set it as always visible.

所以,问题是,中投图标始终可见(当您设置能见度可见或当你将它添加到你的动作条)。

So the issue is that the cast icon is always visible (when you set visibility to visible or when you add it to your actionbar).


该MediaRouter有不同的视图状态。一种用于当一个铸造设备可用,一个用于当没有一个可用

HOWEVER:The MediaRouter has different view states. One for when a cast device is available and one for when there isn't one available.

该Mediarouter库包含PNG图像绘制的是当一个设备是否可用的图标。

The Mediarouter library consists of drawable pngs that are the icons for when a device is available or not.

只需更换适合的应用之一为其没有路由可用一个空白资源,或任何东西。

Just replace the one for which 'no route is available' with a blank resource, or anything that suits the app.

当一个设备可用,正确的投图标将显示,当未提​​供的自定义资源将显示(空白,如果资源是一个空白视图)。

When a device is available, the correct cast icon will show, and when not available your custom resource will show (blank if the resource is a blank view).

下面是关于如何获得mediarouter源$ C ​​$ C的全部细节,以及如何解决这一问题:的

Here are full details on how to obtain the mediarouter source code, and how to fix this: http://www.droidorbit.com/2013/10/mediarouter-and-actionbarsherlock.html

这篇关于MediaRouter:使用ActionBarSherlock当检测到Chromecast设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 09:05