Android-Video View in Fullscreen

前端 未结 6 589
遇见更好的自我
遇见更好的自我 2020-12-01 07:45

I am trying to make this VideoView to appear in full screen mode :

public class ViewVideo extends Activity {
  private String filename;
  private static fina         


        
相关标签:
6条回答
  • 2020-12-01 08:28

    Okey, Let's try like this, this was suitable for my full screen.

        android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
    
    0 讨论(0)
  • 2020-12-01 08:29

    Perhaps it's because you have to add following code:

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(
        WindowManager.LayoutParams.FLAG_FULLSCREEN,  
         WindowManager.LayoutParams.FLAG_FULLSCREEN);
    

    before setContentView(your_content_view) to get rid of app title bar. I know its a very late reply but somebody might find it useful.

    0 讨论(0)
  • 2020-12-01 08:31

    No need of code to play video in full screen mode

    Apply the following layout format over the xml containing the videoview it will for sure will play the video in full screen mode. as it is running mine :) Hope it helps

     <?xml version="1.0" encoding="utf-8"?>
     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
               android:layout_width="fill_parent"
               android:layout_height="fill_parent" >
       <VideoView android:id="@+id/myvideoview"
                 android:layout_width="fill_parent"
                 android:layout_alignParentRight="true"
                 android:layout_alignParentLeft="true"
                 android:layout_alignParentTop="true"
                 android:layout_alignParentBottom="true"
                 android:layout_height="fill_parent">
        </VideoView>
     </RelativeLayout>
    
    0 讨论(0)
  • 2020-12-01 08:32

    Due to my experienced, you can only use Relative-Layout View for you video to be stretch on portrait and landscape. Linear-layout view can only stretch video on Landscape, you can try the two view without writing any code and prove my theory

    0 讨论(0)
  • 2020-12-01 08:43

    Portrait layout

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:background="@android:color/black">
        <VideoView
            android:id="@+id/video_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center" />
    </FrameLayout>
    

    Landscape layout

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@android:color/black">
        <VideoView
            android:id="@+id/video_view"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_gravity="center"/>
    </FrameLayout>
    
    0 讨论(0)
  • 2020-12-01 08:47

    when you click an menu item. you have to start a New Activity. for that Activity you have to set the theme attribute in the Manifest. set this value that is

    android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    

    thats it.

    0 讨论(0)
提交回复
热议问题