非材质主题导致文本输入冻结

时间:2015-09-28 01:45:09

标签: android material-design android-theme

我有一个奇怪的问题。当我使用Material主题时,我的应用程序没有问题,但是当我使用Theme.Holo.Light时,我遇到了这个问题。当我点击任何文本字段输入,EditText或SearchView(键盘弹出)时,应用程序变得无法响应并冻结,虽然键盘仍然键入。我不太了解主题,所以我不确定是什么导致了这一点。我想使用Android版本19,因为我需要我的应用程序可供更多Android用户访问,因此我无法在Android版本19中使用Material Theme

Styles.xml

<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="android:Theme.Holo.Light">
    <!-- Customize your theme here. -->
    <item name="android:showAsAction">always</item>
    <item name="android:colorBackground">#3399ff</item>
    <item name="android:logo">@android:color/transparent</item>


</style>
<style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
    <item name="android:background">@drawable/sweat_header</item>
    <item name="android:backgroundStacked">@drawable/sweat_header</item>
    <item name="android:backgroundSplit">@drawable/sweat_header</item>
</style>

</resources>

1 个答案:

答案 0 :(得分:0)

Make two themes based on the lower and higher versions. I believe that would sort it out.

values/themes.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="AppTheme" parent="AppTheme.Base"/>

    <style name="AppTheme.Base" parent="Theme.AppCompat">
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimary</item>
        <item name="android:windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
    </style>
</resources>

values-v21/themes.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="AppTheme.Base">
    <item name="android:windowContentTransitions">true</item>
    <item name="android:windowAllowEnterTransitionOverlap">true</item>
    <item name="android:windowAllowReturnTransitionOverlap">true</item>
    <item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
    <item name="android:windowSharedElementExitTransition">@android:transition/move</item>
</style>
</resources>

Hope it helps.