Android ChromeCast:点击我的 MiniControllerFragment 不会打开 ExpandedControllerActivity
Android ChromeCast: Tapping on my MiniControllerFragment doesn't open the ExpandedControllerActivity
我有一个布局中有 MiniControllerFragment 的应用程序:
<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 子类:
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 工作。投射时,play/pause 按钮工作正常。然而,点击 MiniController 没有任何作用。它应该打开 ExpandedController,但我不明白我的 MiniController 应该如何知道要启动哪个 Activity。我需要添加清单中的其他代码或其他内容吗?
构建 CastOptions 时,使用其 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()。
我有一个布局中有 MiniControllerFragment 的应用程序:
<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 子类:
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 工作。投射时,play/pause 按钮工作正常。然而,点击 MiniController 没有任何作用。它应该打开 ExpandedController,但我不明白我的 MiniController 应该如何知道要启动哪个 Activity。我需要添加清单中的其他代码或其他内容吗?
构建 CastOptions 时,使用其 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()。