AppCompatActivity removes the title bar and EditText. the keyboard is displayed to cover the input box,
1. Remove the title bar from AppCompatActivity
Remove the title bar here. Note that AppCompactActivity inherits from Activity. However, according to the online data, AppCompactActivity does not seem to have a title bar. The title bar shown above is an ActionBar control (PS: that is, the title bar is a control, therefore, AppCompactActivity can add related return buttons and many other similar function buttons to the control. If you do not add these buttons, it will look like a title bar.
Therefore, the title bar cannot be effectively removed when the style. xml file in the value folder is configured on the Internet or the theme attribute value is modified in the AndroidManifest. xml file. These methods only apply to classes written from the Activity.
The class inherited from AppCompactActivity can effectively hide the title bar by adding the following line of code to onCreateView. You can add two lines to occupy the full screen. (PS: after being tested by the landlord, you can hide the normal browsing and sliding interface. However, in some cases, for example, this interface has a video playback function. After you click play in full screen and exit the full screen, the title bar may not be hidden. However, the hiding function is normal)
Getsuppactionactionbar (). hide (); // hide the title bar getWindow (). setFlags (WindowManager. layoutParams. FLAG_FULLSCREEN, WindowManager. layoutParams. FLAG_FULLSCREEN); // enables full screen to hide time-related information on the top of the phone.
References: Android Development: The activity inherits AppCompatActivity and removes the title bar.
2.
In EditText, the keyboard is displayed to cover the input box.
The specific explanation is excerpted from a netizen blog (PS: it is convenient for you to check it later,Original article link)
Activity configuration in AndroidManifest. xml:Android: windowSoftInputMode = "adjustResize"(PS: or change"StateVisible | adjustResize",A floppy disk is forcibly displayed.)
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.helloworld"> <uses-permission android:name="android.permission.INTERNET" /> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".Main2Activity" android:windowSoftInputMode="adjustResize"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".MainActivity"></activity> </application></manifest>
Meaning: The Screen Content of the page is compressed to free up space on the keyboard.
Explain their meanings:
- StateUnspecified: The status when "android: windowSoftInputMode" is not set on the interface. This status indicates that the EditText interface always does not display the soft keyboard. When EditText gets the focus, the software disk is displayed.
- StateUnchanged: The status does not change, which means it is the same as the previous interface. A Soft Keyboard pops up on the previous interface. When you jump to this interface, the soft keyboard also pops up.
- StateHidden: hides the keyboard. When this interface is displayed, the keyboard is hidden no matter the status of the previous interface.
- StateAlwaysHidden: keep hiding (the difference is unknown and cannot be found ).
- StateVisible: the soft keyboard is forced to pop up. After you jump to the page, the keyboard is displayed without EditText.
- StateAlwaysVisible: displays the keyboard all the time (same as above ).