简体   繁体   中英

How do I write 'android:configChanges=“keyboardHidden”' in code?

How can I do it with Java code instead of XML? Thanks

android:configChanges="keyboardHidden"

Short answer : You cannot.

Long answer : it is not possible out of the box, I guess you could disassemble the Activity class and study the code, and rewrite it in a sublclass, but I believe that you will get more trouble than you will solve.

You need to write that in android manifest.xml and then have to override this method :

public void onConfigurationChanged(Configuration newConfig) 
{
     super.onConfigurationChanged(newConfig);
     //do your coding 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM