2015-09-28 30 views
0

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

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> 

回答

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. 
+0

我不能有一个v21的XML,因为我正在建设和瞄准API级别19,而不是21 –

+0

我相信它主要的布局比主题更多的代码。如果您发布主要活动代码会更好。如果没有,我建议你做一个新的项目,并从基地开始。 – Limbu