2015-09-28 31 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