darigold 2017-3-19 08:07
搞唔掂 :smile_o16:
請幫忙。
[url=https://stackoverflow.com/questions/42881301/android-videoview-bringtofront-does-not-work-for-the-second-time-in-xamarin]StackOverflow[/url]
Susan﹏汪汪 2017-3-19 14:51
汪汪冇Windows 冇Xamarin又冇Android 幫唔到手
darigold 2017-3-20 06:54
順帶一提,Xamarin 有 MacOSX 版,Android 也有 MacOSX 的 Simulator。
有諗辦法 2017-3-20 07:56
[quote]原帖由 [i]darigold[/i] 於 2017-3-20 06:54 AM 發表 [url=http://www.discuss.com.hk/redirect.php?goto=findpost&pid=458282315&ptid=26522662][img]http://www.discuss.com.hk/images/common/back.gif[/img][/url]
順帶一提,Xamarin 有 MacOSX 版,Android 也有 MacOSX 的 Simulator。 [/quote]
我只係估下唧 ,有冇試過唔寫死喺 layout 入面 ,而自己用 code 去 create 個 View 出嚟 ,咁會唔會一定喺面呢 ?
補充一下 ,汪汪喺唔掂 C# 嘅 :lol
[[i] 本帖最後由 有諗辦法 於 2017-3-20 07:57 AM [url=http://www.discuss.com.hk/android][img=100,23]http://i.discuss.com.hk/d/images/r10/androidD.jpg [/img][/url] 編輯 [/i]]
form5 2017-3-20 18:56
[code]using Android.App;
using Android.Widget;
using Android.OS;
using Android.Media;
using System;
using Android.Views;
namespace Experiment
{
public class Listener : Java.Lang.Object, MediaPlayer.IOnCompletionListener
{
private Action action;
public Listener(Action action)
{
this.action = action;
}
public void OnCompletion(MediaPlayer unused)
{
this.action();
}
}
[Activity(Label = "Experiment", MainLauncher = true, Icon = "@mipmap/icon")]
public class MainActivity : Activity
{
private VideoView foreView;
private VideoView backView;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Main);
foreView = this.FindViewById(Resource.Id.foreView);
backView = this.FindViewById(Resource.Id.backView);
var uriForView = Android.Net.Uri.Parse("android.resource://" + Application.PackageName + "/" + Resource.Raw.hotStuff);
foreView.SetVideoURI(uriForView);
foreView.SetOnCompletionListener(new Listener(OnForeViewCompleted1));
var uriBackView = Android.Net.Uri.Parse("android.resource://" + Application.PackageName + "/" + Resource.Raw.veryHotStuff);
backView.SetVideoURI(uriBackView);
backView.SetOnCompletionListener(new Listener(OnBackViewCompleted1));
foreView.Start();
}
private void OnForeViewCompleted1()
{
RunOnUiThread(() =>
{
backView.Start();
backView.Visibility = ViewStates.Visible;
foreView.Visibility = ViewStates.Invisible;
backView.BringToFront();
backView.Invalidate();
});
}
private void OnBackViewCompleted1()
{
RunOnUiThread(() =>
{
foreView.Start();
foreView.Visibility = ViewStates.Visible;
backView.Visibility = ViewStates.Invisible;
foreView.BringToFront();
foreView.Invalidate();
});
}
}
}[/code]change few lines of your code, seems working pretty well on my android emulator
:lol:lol