SoFunction
Updated on 2025-04-10

How to implement fixed screen display on Android

This article describes the method of Android to implement fixed screen display. Share it for your reference. The details are as follows:

In Android development, we will encounter the situation of development screen twisting. How to fix the screen ScreenOrientation?

When learning jetboy code, I found that the screen was rotated. I found that the relevant settings were not found on the code search, and found the relevant code:

Find this code:

Copy the codeThe code is as follows:
android:screenOrientation="portrait"

Portrait means landscape, landscape means portrait

If you want to make the Activity View interface full screen, you only need to hide the top signal bar and the Activity Title bar, and hide the code of the Title bar:

Copy the codeThe code is as follows:
requestWindowFeature(Window.FEATURE_NO_TITLE);

Code in the configuration file:

Copy the codeThe code is as follows:
android:theme="@android:style/"

 
Code to hide signal bar:
Copy the codeThe code is as follows:
getWindow().setFlags(.FLAG_FULLSCREEN, .FLAG_FULLSCREEN);

 
Other uses:
Copy the codeThe code is as follows:
getWindow().setFlags(.TYPE_STATUS_BAR, .TYPE_STATUS_BAR);

 
At this point, the screen fixation problem in Android development has been solved!
<manifest xmlns:andro
  package="" android:versionCode="1"
  android:versionName="1.0.0"> 
  <application android:icon="@drawable/icon"
    android:label="@string/app_name"
    android:theme="@android:style/"> 
    <activity android:name=".JetBoy"
      android:label="@string/app_name"
      android:screenOrientation="portrait"
      > 
      <intent-filter> 
        <action android:name="" /> 
        <category 
          android:name="" /> 
      </intent-filter> 
    </activity> 
  </application> 
  <uses-sdk android:minSdkVersion="4"></uses-sdk> 
  <!--  
  <uses-library android:name="" /> 
  <instrumentation 
  android:name="" 
  android:targetPackage="" 
  android:functionalTest="true" android:label="Jetboy Test All Runner"/>    
  <uses-permission android:name=".RUN_INSTRUMENTATION"/> 
   --> 
</manifest> 
<manifest xmlns:andro
 package="" android:versionCode="1"
 android:versionName="1.0.0">
 <application android:icon="@drawable/icon"
 android:label="@string/app_name"
 android:theme="@android:style/">
 <activity android:name=".JetBoy"
  android:label="@string/app_name"
  android:screenOrientation="portrait"
  >
  <intent-filter>
  <action android:name="" />
  <category
   android:name="" />
  </intent-filter>
 </activity>
 </application>
 <uses-sdk android:minSdkVersion="4"></uses-sdk>
 <!--
 <uses-library android:name="" />
 <instrumentation
  android:name=""
  android:targetPackage=""
  android:functionalTest="true" android:label="Jetboy Test All Runner"/>  
 <uses-permission android:name=".RUN_INSTRUMENTATION"/>
 -->
</manifest>

I hope this article will be helpful to everyone's Android programming design.