2016-06-09 46 views

回答

1

我添加上的活動一些代碼,從這個鏈接:

http://explod.io/setting-the-theme-of-mediaroutechooserdialog/

MediaRouteDialogFactory mMediaRouteDialogFactory = new VideoMediaRouteDialogFactory() { 

    @NonNull 
    @Override 
    public MediaRouteChooserDialogFragment onCreateChooserDialogFragment() { 
     return new MediaRouteChooserDialogFragment() { 
      @Override 
      public MediaRouteChooserDialog onCreateChooserDialog(Context context, Bundle savedInstanceState) { 
       return new MediaRouteChooserDialog(context, android.R.style.Theme_Material_Light_Dialog); 
      } 
     }; 
    } 
}; 

@Override 
public boolean onCreateOptionsMenu(Menu menu) { 
    MenuInflater inflater = getMenuInflater(); 
    inflater.inflate(R.menu.my_menu, menu); 
    mMediaRouteMenuItem = mCastManager.addMediaRouterButton(menu, R.id.media_route_menu_item); 
    MenuItem routeItem = menu.findItem(R.id.media_route_menu_item); 
    MediaRouteActionProvider mediaRouteButton = (MediaRouteActionProvider) MenuItemCompat.getActionProvider(routeItem); 
    mediaRouteButton.setDialogFactory(mMediaRouteDialogFactory); 
    return true; 
} 
+0

u能請您分享它的全部源代碼? –

2

這是不相關或由CCL管理;在該對話框中,主題由MediaRouteThemeHelper管理。您可以在自己的應用程序中覆蓋Theme.MediaRouter.Light.DarkControlPanelTheme.MediaRouter.LightControlPanel樣式,並調整對話框的主題。