android activity全屏的方式

首先在activity的onCreate()方法中的super.onCreate(savedInstanceState)方法

和setContentView(R.id.activity_main)方法之间,

添加下面的两条语句

 

//无title
requestWindowFeature(Window.FEATURE_NO_TITLE);
//全屏
getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN ,

               WindowManager.LayoutParams. FLAG_FULLSCREEN);

如果想要实现几秒钟之后跳转到下一个activity的话

然后打开activity_main.xml

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#cc4b00"
    tools:context="com.bignerdranch.android.myapplication.FullscreenActivity"/>

最后打开AndroidMainifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bignerdranch.android.myapplication"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name">
    <activity android:name=".FullscreenActivity"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>
<uses-sdk android:minSdkVersion="7" />
</manifest>

猜你喜欢

转载自blog.csdn.net/lalala_HFUT/article/details/79590762