Sean's Note: 1月 2016

2016年1月15日 星期五

[Odd Issue] The "windowSoftInputMode" may not work when declare a theme style for an activity.

紀錄一下:

styles.xml:
<style name="UAppTheme" parent="@android:style/Theme.Holo.Light.NoActionBar">
</style>

AndroidManifest.xml:
<activity
   android:name="com.XXX..activity.MyActivity"
   android:theme="@style/AppTheme">
   android:label="@string/app_name"
   android:screenOrientation="portrait"
   android:windowSoftInputMode="stateHidden|adjustPan" >
</activity>

Solution:
styles.xml:
<style name="UAppTheme" parent="@android:style/Theme.Holo.Light.NoActionBar">
<item name="android:windowSoftInputMode">stateHidden|adjustPan</item>
</style>