1
フラグメントでDialogでvideoViewを設定する方法。DialogでvideoViewを設定する方法android
と私は仕事されていないしてみてください(ノーショービデオ)
AlertDialog.Builder builder = new AlertDialog.Builder(context);
final AlertDialog dialog = builder.create();
final VideoView video_player_view = (VideoView)dialog.findViewById(R.id.videos);
LayoutInflater inflater = ((HomeActivity)context).getLayoutInflater();
View dialogLayout = inflater.inflate(R.layout.fragment_fong, null);
dialog.setView(dialogLayout);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.show();
WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
lp.copyFrom(dialog.getWindow().getAttributes());
dialog.getWindow().setAttributes(lp);
Uri uri = Uri.parse("http://file2.video9.in/english/movie/2014/x-men-_days_of_future_past/X-Men-%20Days%20of%20Future%20Past%20Trailer%20-%20[Webmusic.IN].3gp");
video_player_view.setVideoURI(uri);
video_player_view.start();
とfragment_fong.xml(videoView)あなたは
変更:最終的なVideoView video_player_view =(VideoView)dialog.findViewById(R.id.videos); 〜 final VideoView video_player_view =(VideoView)dialogLayout.findViewById(R.id.videos); – akhilesh0707
@ akhilesh0707まだエラーがあります –
videoViewは表示されますが、ビデオは再生されませんか? –