【发布时间】:2018-03-25 10:35:48
【问题描述】:
我正在开发一个集成 Cast 的应用。我可以设置一个投射按钮,甚至可以将我的应用投射到 ChromeCast。但是,当我将 MediaRouter 包含为依赖项时,浮动操作按钮的样式会很奇怪(或不存在)。
这是正确样式的按钮:
当我添加 MediaRouter 依赖项时会发生以下情况:
// build.gradle
dependencies {
// ....
// Removing the mediarouter fixes the "design" of the toaster, but then crashes app
implementation 'com.android.support:mediarouter-v7:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.gms:play-services-cast-framework:10.0.1'
implementation 'com.android.support:design:26.1.0'
// ...
对可能导致此问题的原因或我应该如何解决它有什么想法吗?
【问题讨论】:
-
您是否尝试将 castBackground 设置为 @drawable/abc_dialog_material_background
-
能否将代码发布为按钮样式
-
这在我看来像是一个对话框,而不是一个按钮。
-
您提到如果删除 medirouter-v7 会导致崩溃。你可以发布堆栈跟踪吗?
-
@EugenPechanec 崩溃基本上是因为当您不包含其库时未定义 MediaRouter 的回调。
标签: android android-gradle-plugin android-support-library android-design-library android-cast-api