问题描述
我有一个在布局中具有MiniControllerFragment的应用程序:
I have an app that has a MiniControllerFragment in the layout:
<fragment
android:id="@+id/cast_mini_controller"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="visible"
app:castShowImageThumbnail="true"
app:
class="com.google.android.gms.cast.framework.media.widget.MiniControllerFragment" />
我还有一个ExpandedControllerActivity子类:
I also have an ExpandedControllerActivity subclass:
public class ExpandedControlsActivity extends ExpandedControllerActivity {
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.expanded_controller, menu);
CastButtonFactory.setUpMediaRouteButton(this, menu, R.id.media_route_menu_item);
return true;
}
}
MiniController起作用.投射时,播放/暂停按钮可以正常工作.但是,点击MiniController不会执行任何操作.应该打开ExpandedController,但是我没有看到我的MiniController如何知道要启动哪个Activity.我需要在清单中添加其他代码或其他内容吗?
The MiniController works. When casting, the play/pause buttons work fine. However, tapping on the MiniController does nothing. It is supposed to open the ExpandedController, but I don't see how my MiniController is supposed to know which Activity to start. Is there additional code or something in the manifest I need to add?
推荐答案
在构建CastOptions时,请使用其生成器,您需要传递 CastMediaOption .后一类(CastMediaOption)可以使用其生成器,它通过调用 setExpandedControllerActivityClassName ().
When you construct your CastOptions, using its Builder, you need to pass in a CastMediaOption. This latter class (CastMediaOption) can be constructed using its Builder, which takes the name of your expanded controller activity, by calling setExpandedControllerActivityClassName().
这篇关于Android ChromeCast:在我的MiniControllerFragment上点击无法打开ExpandedControllerActivity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!