我正在尝试自定义转换控制器对话框,我在更改对话框的标题样式时遇到问题。我已经像CCL库一样实现了它,但没有成功。
这是我的相关代码:
VideoMediaRouteControllerDialog.java
public VideoMediaRouteControllerDialog(Context context) {
super(context, xxx.xxx.R.style.TTNCastDialog);
...
}
VideoMediaRouteControllerDialogFragment.java
public class VideoMediaRouteControllerDialogFragment extends MediaRouteControllerDialogFragment {
@Override
public VideoMediaRouteControllerDialog onCreateControllerDialog(Context context, Bundle savedInstanceState) {
VideoMediaRouteControllerDialog customControllerDialog = new VideoMediaRouteControllerDialog(context);
customControllerDialog.setVolumeControlEnabled(false);
return customControllerDialog;
}
}
VideoMediaRouteDialogFactory.java
public class VideoMediaRouteDialogFactory extends MediaRouteDialogFactory {
@Override
public VideoMediaRouteControllerDialogFragment onCreateControllerDialogFragment() {
return new VideoMediaRouteControllerDialogFragment();
}
}
styles.xml
<style name="TTNCastDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowTitleStyle">@style/TTNCastDialogWindowTitle</item>
</style>
<style name="TTNCastDialogWindowTitle">
<item name="android:textSize">22sp</item>
<item name="android:textColor">@color/ccl_mr_custom_title</item>
</style>
styles.xml(V21)
<style name="TTNCastDialog" parent="android:Theme.Material.Dialog">
<item name="android:windowTitleStyle">@style/TTNCastDialogWindowTitle</item>
</style>
我看过MediaRouteThemeHelper的getButtonTextColor方法
并返回强调色而不是原色。我的应用程序主题扩展了Theme.AppCompat.Light.NoActionBar
我也尝试过这种方式
styles.xml
<style name="TTNCastDialog" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="android:windowTitleStyle">@style/TTNCastDialogWindowTitle</item>
</style>
<style name="TTNCastDialogWindowTitle">
<item name="android:textSize">22sp</item>
<item name="android:textColor">@color/ccl_mr_custom_title</item>
</style>
但它不起作用。
有什么建议吗?
由于