• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps how to play video in Full Screen??!

wounded

Newbie
Hi all,

can someone help me how t play video in full-Screen android.
my video play but not in fullScreen.



here is my code;
MainActivity.java
--------------------

public
class MainActivity extends Activity {


@Override
publicvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
VideoView vd = (VideoView) findViewById(R.id.VideoView);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(vd);
vd.setMediaController(mediaController);
vd.setKeepScreenOn(true);
vd.setVideoPath("android.resource://com.video.pideo/raw/"+R.raw.number);
vd.start();
vd.requestFocus();


}
}

Activity_main.xml
--------------------
<?xmlversion="1.0"encoding="utf-8"?>

<



LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"


android:layout_width


="fill_parent"

android:layout_height


="fill_parent"

>



<


VideoView

android:id="@+id/VideoView"
android:layout_width="fill_parent"
android:layout_height="666dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true">
</


VideoView>
</LinearLayout>


ihope toget a reply
thnks in advance​
 
your android:layout_height attribute for your VideoView is set to 666dip. For fullscreen, you should set it to fill_parent.
 
your android:layout_height attribute for your VideoView is set to 666dip. For fullscreen, you should set it to fill_parent.


Welcome jonbonazza,

it doesnt work

as you saw Previous picture,,my actual video is in the black color and it leave a gap or blank space between video and buttons(play/stop...) who can i remove this space?

thnkx
 
Did you try this?

Code:
Activity_main.xml
--------------------
<?xmlversion="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"
android:orientation="vertical"
>
<VideoView
android:id="@+id/VideoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true">
</VideoView>
</LinearLayout>
 
Did you try this?

Code:
Activity_main.xml
--------------------
<?xmlversion="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"
android:orientation="vertical"
>
<VideoView
android:id="@+id/VideoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true">
</VideoView>
</LinearLayout>


i got this , still the same

 
Hmm thinking about it, VideoView is probably coded to retain a certain aspect ratio, so it likely won't go fullscreen in portrait mode. Does it work as intended in landscape mode?

EDIT: Moved to main Android App Dev forums.
 
I did a project a while back where I had to be able to control the aspect ratio of a VideoView control. What I ended up doing was create a class that extends VideoView and then override the "onMeasure" method to calculate the width and height I wanted and call "setMeasuredDimension" with those values. Otherwise I think jonbonazza is right, the VideoView will try to keep a set aspect ratio.

To set the video to full screen, I think you need to use something like this:

[HIGH]
public class MyVideoView extends VideoView {

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int containerWidth = MeasureSpec.getSize(widthMeasureSpec);
int containerHeight = MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(containerWidth, containerHeight);
}

}
[/HIGH]
 
I agree with mrichards957. I did some more searching and this is the only conclusion I could seem to come up with, albeit not exactly convenient.
 
it doesnt work with me..
i will try to use webview to play .swf files that contains video
so if you any idea
thnks to all for ur reply
 
Back
Top Bottom