Video not centered In any layout [Android]
I'm trying to center a video played in a Fullscreen activity but whatever
parameter i place in whatever layout doesn't seem to work
This is the piece of my manifest:
<activity
android:name=".VideoActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
</activity>
My video_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
<VideoView
android:id="@+id/videoView"
android:gravity="center"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
And the activity in case you need it
public class VideoActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video_layout);
VideoView videoHolder = new VideoView(this);
setContentView(videoHolder);
Uri video = Uri.parse("android.resource://" + getPackageName() + "/"+
R.raw.video);
videoHolder.setVideoURI(video);
videoHolder.start();
videoHolder.setOnCompletionListener(new OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
jump();
}
});
}
private void jump() {
if(isFinishing())
return;
finish();
pd.dismiss();
}
}
I've tried with FrameLayou, RelativeLayout, LinearLayout
centering gravity, centering layout_gravity and it keeps displaying it on
top of the window in portrait and in the left-botom corner in landscape
I'd put a photo but I lack of reputation Thanks in advance
No comments:
Post a Comment