Hello,
I want to find out if the black screen that appears before a video is played will be the same when I use Android Exoplayer:
This black screen caused by the following line. If you comment out this line, this black screen will disappear.
SetContentView(_view);
You application need to load the GameView by _view = _game.Services.GetService(typeof(View)) as View;
, then set the game view to Activity. But Activity has a default layout when initializing.
We cannot avoid the black screen when you SetContentView(_view). However, we can make the default layout to transparent, when you application start, you will see the transparent view, then black screen appears, you can see your game view in the end .
Firstly, create a styles.xml
in the Values folder and make sure the build action is AndroidResouce
Then copy the following style in it. This style is set the default layout to transparent.
<?xml version="1.0" encoding="utf-8" ?>
<resources>
<style name="MainTheme" parent="@android:style/Theme.Holo">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
</resources>
Next, add the Theme to the [Acitivty] tag.
[Activity(
Theme = "@style/MainTheme",
Label = "@string/app_name",
....
)]
public class Activity1 : AndroidGameActivity
If you want to make the Dialog without titlebar. Please change your VideoDialog's constructor like following code.
public VideoDialog(Context context,int themeResId) : base(context, themeResId)
{
initView(context);
}
When you show your VideoDialog. You can set the no action bar style like following code.
public async void ShowTheVideo()
{
VideoDialog customDialog = new VideoDialog(activity1,Android.Resource.Style.ThemeDeviceDefaultDialogNoActionBar);
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.