Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何设置应用程序以全屏运行_Java_Android - Fatal编程技术网

Java 如何设置应用程序以全屏运行

Java 如何设置应用程序以全屏运行,java,android,Java,Android,你好,我有一个问题,我正在创建一个应用程序,将重复景观视频作为背景,但我不知道如何设置在全屏。我正在Android studio中创建应用程序。应用程序将有这样的风景>试试这个 方式1。在清单中设置 <activity ... android:theme="@android:style/Theme.NoTitleBar.Fullscreen" /> <activity android:name=".LoginActivity" android:them

你好,我有一个问题,我正在创建一个应用程序,将重复景观视频作为背景,但我不知道如何设置在全屏。我正在Android studio中创建应用程序。应用程序将有这样的风景>

试试这个

方式1。在清单中设置

<activity
    ...
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
<activity android:name=".LoginActivity"
    android:theme="@style/theme_fullScreen"/>
方式3。在清单中设置,并在样式中设置

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <style name="theme_fullScreen" parent="android:Theme.Black"> 
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowFullscreen">true</item>
    </style> 
</resources>

真的
真的
在舱单上

<activity
    ...
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
<activity android:name=".LoginActivity"
    android:theme="@style/theme_fullScreen"/>

注意

  • 更改
    活动的
    android:theme
  • 设置
    getWindow().setFlags(WindowManager.LayoutParams.FILL\u父项,WindowManager.LayoutParams.FILL\u父项)
    • 给你

      要播放视频,请在“res”文件夹下创建一个文件夹名“raw”。在“原始”文件夹下复制视频。请将视频名称保留为小字符。一旦完成,请做以下修改

    • style.xml

      <!-- Base application theme. -->
      
      
      <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
          <!-- Customize your theme here. -->
          <item name="colorPrimary">@color/colorPrimary</item>
          <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
          <item name="colorAccent">@color/colorAccent</item>
      </style>
      
      <style name="AppTheme.FullScreen" parent="AppTheme">
          <item name="android:windowFullscreen">true</item>
      </style>
      

      }

    • activity_main.xml

      `

      
      
    • `

      注意-请记住,videoview应该是父布局的直接子级,其他视图/布局将位于videoview之后


      这就是你想要的吗?

      开始用你的投票权来使用它吧?你好@NileshRathod。我已经观察你很久了。我很高兴与你交流。我不生气。你很好。很抱歉我的英语很差。@NileshRathodenjoy codding很高兴与您交流,以帮助我
          <VideoView
              android:id="@+id/videoView"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              tools:layout_editor_absoluteX="0dp"
              tools:layout_editor_absoluteY="0dp" />
      
          <TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Hello World!"
              android:textSize="30dp"
              app:layout_constraintBottom_toBottomOf="parent"
              app:layout_constraintLeft_toLeftOf="parent"
              app:layout_constraintRight_toRightOf="parent"
              app:layout_constraintTop_toTopOf="parent"></TextView>
      
      </android.support.constraint.ConstraintLayout>