2012-08-10 2 views
0

버튼에 테마를 적용하는 데 문제가 있습니다. 이 http://i48.tinypic.com/w03s6x.png테마를 적용한 후에 Android 버튼이 이상하게 보입니다.

버튼의 높이가 색상이 괜찮지 만 : 내 테마를 적용한 후 http://i47.tinypic.com/2czyctv.jpg

그것은 다음과 같습니다 :이 스크린 샷에서 볼 수 있듯이 테마 모두를 사용하지 않고 잘 보인다 잘못되어 상단 버튼과 수평선 사이의 공간이 사라졌습니다. 실제로 테마 버튼은 크기가 변경되지 않은 버튼처럼 보일 것입니다. 왜냐하면 변경하려는 유일한 것은 색상 이었기 때문입니다.

값/themes.xml :

<?xml version="1.0" encoding="utf-8"?> 
<resources xmlns:android="http://schemas.android.com/apk/res/android"> 

<style name="Theme.KIT.Styled" parent="Theme.Sherlock.Light.DarkActionBar"> 

    <item name="actionBarStyle">@style/ActionBar</item> 
    <item name="android:actionBarStyle">@style/ActionBar</item> 
    <item name="android:buttonStyle">@style/Button</item> 

</style> 

<style name="ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse"> 
    <item name="background">@drawable/actionbar_background_shape</item> 
    <item name="android:background">@drawable/actionbar_background_shape</item> 
</style> 

<style name="Button" parent="@android:style/Widget.Button"> 
    <item name="android:background">@drawable/kit_button</item> 
</style> 
</resources> 

그리기/kit_button.xml :

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
<item 
    android:state_enabled="false" 
    android:drawable="@drawable/kit_button_background_shape" /> 
<item 
    android:state_pressed="true" 
    android:state_enabled="true" 
    android:drawable="@drawable/kit_button_background_shape" /> 
<item 
    android:state_focused="true" 
    android:state_enabled="true" 
    android:drawable="@drawable/kit_button_background_shape" /> 
<item 
    android:state_enabled="true" 
    android:drawable="@drawable/kit_button_background_shape" /> 
</selector> 

가 그리기/kit_button_background_shape.xml

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" > 
<gradient 
    android:startColor="@color/KIT_GREEN" 
    android:endColor="@color/KIT_GREEN_LIGHT" 
    android:angle="90" 
    android:centerX="0.5" 
    android:centerY="0.5" /> 
</shape> 

제가 s.o. 희망 나를 도와 줄 수 있니. 내 나쁜 영어에 대해 유감스럽게 생각합니다.

답변

0

버튼 패딩이 9 패치 배경 내에서 사용되었지만 GradientDrawable이이를 대신하지 않습니다. 테마에 안드로이드 : 패딩 속성을 추가하거나 9 패치를 사용해야합니다.

관련 문제