Appcompatactivity Remove title bar and EditText pop-up soft keyboard to obscure input box problem

Source: Internet
Author: User

1. appcompatactivity Remove the title bar

To get rid of the title bar here, it is important to note that Appcompactactivity is inherited from activity. However, appcompactactivity according to view the online information, in fact, it seems to have no title bar, the title bar shown above is a Actionbar control (PS: That is, the title bar part is a control, the control function is also relatively strong), So appcompactactivity can add related returns, many similar function buttons to the control, and if you don't add those buttons it looks like a title bar.

Therefore, many on-line to configure the value folder in the Style.xml file or in the Androidmanifest.xml file to modify the theme attribute value is not effective to remove the title bar. These methods only apply to classes that are written to inherit from activity.

Then inherit from the Appcompactactivity class, add the following first line of code in the Oncreateview to effectively hide the title bar, add two lines can occupy full screen function. (PS: After the landlord to test the normal browsing sliding interface can be hidden, but in some cases, such as the interface has a video playback function, click Full-screen playback, exit full screen, the title bar may not be hidden. However, in general, the hidden function is not a problem)

Getsupportactionbar (). Hide ();   // Hide title bar GetWindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_ fullscreen);   // realize full screen, hide the phone on the top of the time-related information display

Reference :Android Development: Activity inheritance appcompatactivity Remove title bar

2. edittext pop-up soft keyboard obscures input box issues

The specific explanation excerpt from a netizen blog (PS: Convenient after their own inspection, the original link )

The corresponding activity configuration in Androidmanifest.xml:android:windowsoftinputmode= "Adjustresize"(PS: or Replace with "Statevisible|adjustresize", This will force eject floppy disk )

<?XML version= "1.0" encoding= "Utf-8"?><Manifestxmlns:android= "Http://schemas.android.com/apk/res/android" Package= "Com.example.helloworld">    <uses-permissionAndroid:name= "Android.permission.INTERNET" />    <ApplicationAndroid:allowbackup= "true"Android:icon= "@mipmap/ic_launcher"Android:label= "@string/app_name"Android:supportsrtl= "true"Android:theme= "@style/apptheme">        <ActivityAndroid:name=". Main2activity "android:windowsoftinputmode= "Adjustresize">            <Intent-filter>                <ActionAndroid:name= "Android.intent.action.MAIN" />                <categoryAndroid:name= "Android.intent.category.LAUNCHER" />            </Intent-filter>        </Activity>        <ActivityAndroid:name=". Mainactivity "></Activity>    </Application></Manifest>

Meaning: The page screen content is compressed to free up space on the soft keyboard.

Explain what they mean:

    • Stateunspecified: The interface does not have a status of "Android:windowsoftinputmode". This state is pop-up with EditText interface does not eject the soft keyboard, when the EditText to get the focus of the software tray Popup
    • Stateunchanged: The state does not change, meaning is the same as the previous interface, the previous interface pop-up soft keyboard, jump to this interface, the soft keyboard is also pop-up state.
    • Statehidden: Hide the keyboard, pop up this interface, regardless of the previous interface is what state, the interface of the soft keyboard is hidden.
    • Statealwayshidden: Always hide (with the above difference unknown, try not to come out).
    • Statevisible: Force eject soft keyboard. After jumping to the interface, no edittext also pops up the keyboard.
    • Statealwaysvisible: Always display the keyboard (IBID.).

Appcompatactivity Remove the title bar and EditText pop-up soft keyboard to obscure the input box problem

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.