je travaille videoview. J'ai écrit le code sorcière peut lire la vidéo de l'url avec asynctask.at le moment tout est ok mais j'ai un autre problème. quand je cours mon application videoview n'est pas en plein écran.Android videoview plein écran
[j'ai comme ça resulit 1
c'est ma source
public class Layout1 extends Fragment {
VideoView video;
MediaController media;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@SuppressWarnings("deprecation")
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_layout1, null);
video = (VideoView) view.findViewById(R.id.video_view);
new BackgroundAsyncTask()
.execute(Global.yutubeDownloadUrl);
return view;
}
public class BackgroundAsyncTask extends AsyncTask<String, Uri, Void> {
Integer track = 0;
ProgressDialog dialog;
protected void onPreExecute() {
dialog = new ProgressDialog(getActivity());
dialog.setMessage("Loading, Please Wait...");
dialog.setCancelable(true);
dialog.show();
}
protected void onProgressUpdate(final Uri... uri) {
try {
media=new MediaController(getActivity());
video.setMediaController(media);
media.setVisibility(View.GONE);
media.setPrevNextListeners(new View.OnClickListener() {
@Override
public void onClick(View v) {
// next button clicked
}
}, new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
media.show();
video.setVideoURI(uri[0]);
video.requestFocus();
video.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer arg0) {
video.start();
dialog.dismiss();
}
});
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
}
}
@Override
protected Void doInBackground(String... params) {
try {
Uri uri = Uri.parse(params[0]);
publishProgress(uri);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
et code xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<VideoView
android:id="@+id/video_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
ce que je fais mal? si quelqu'un sait solution s'il vous plaît aidez-moi