2015-02-04 3 views
0

나는 androidActionBar에 필요한 .png 파일 인 styl.xml을 만들었습니다. 난 내 AndroidManifest를로 이동하여style.xml android ActionBar

android:theme="@style/Theme.AppCompat.Light.DarkActionBar" 

로 변경하는 경우 지금

<resources> 

    <style name="Theme.Example" parent="@android:style/Theme.Holo.Light"> 
     <item name="android:actionBarItemBackground">@drawable/ab_selectable_background_example</item> 
     <item name="android:popupMenuStyle">@style/PopupMenu.Example</item> 
     <item name="android:dropDownListViewStyle">@style/DropDownListView.Example</item> 
     <item name="android:actionBarTabStyle">@style/ActionBarTabStyle.Example</item> 
     <item name="android:actionDropDownStyle">@style/DropDownNav.Example</item> 
     <item name="android:actionBarStyle">@style/ActionBar.Solid.Example</item> 
     <item name="android:actionModeBackground">@drawable/cab_background_top_example</item> 
     <item name="android:actionModeSplitBackground">@drawable/cab_background_bottom_example</item> 
     <item name="android:actionModeCloseButtonStyle">@style/ActionButton.CloseMode.Example</item> 


    </style> 

    <style name="ActionBar.Solid.Example" parent="@android:style/Widget.Holo.Light.ActionBar.Solid"> 
     <item name="android:background">@drawable/ab_background_textured_example</item> 
     <item name="android:backgroundStacked">@drawable/ab_stacked_solid_example</item> 
     <item name="android:backgroundSplit">@drawable/ab_background_textured_example</item> 
     <item name="android:progressBarStyle">@style/ProgressBar.Example</item> 
    </style> 

    <style name="ActionBar.Transparent.Example" parent="@android:style/Widget.Holo.Light.ActionBar"> 
     <item name="android:background">@drawable/ab_transparent_example</item> 
     <item name="android:progressBarStyle">@style/ProgressBar.Example</item> 
    </style> 

    <style name="PopupMenu.Example" parent="@android:style/Widget.Holo.Light.ListPopupWindow"> 
     <item name="android:popupBackground">@drawable/menu_dropdown_panel_example</item> 
    </style> 

    <style name="DropDownListView.Example" parent="@android:style/Widget.Holo.Light.ListView.DropDown"> 
     <item name="android:listSelector">@drawable/ab_selectable_background_example</item> 
    </style> 

    <style name="ActionBarTabStyle.Example" parent="@android:style/Widget.Holo.Light.ActionBar.TabView"> 
     <item name="android:background">@drawable/ab_tab_indicator_ab_example</item> 
    </style> 

    <style name="DropDownNav.Example" parent="@android:style/Widget.Holo.Light.Spinner"> 
     <item name="android:background">@drawable/ab_spinner_background_ab_example</item> 
     <item name="android:popupBackground">@drawable/menu_dropdown_panel_example</item> 
     <item name="android:dropDownSelector">@drawable/ab_selectable_background_example</item> 
    </style> 

    <style name="ProgressBar.Example" parent="@android:style/Widget.Holo.Light.ProgressBar.Horizontal"> 
     <item name="android:progressDrawable">@drawable/ab_progress_horizontal_example</item> 
    </style> 

    <style name="ActionButton.CloseMode.Example" parent="@android:style/Widget.Holo.Light.ActionButton.CloseMode"> 
     <item name="android:background">@drawable/btn_cab_done_default_example</item> 
    </style> 

    <!-- this style is only referenced in a Light.DarkActionBar based theme --> 
    <style name="Theme.Example.Widget" parent="@android:style/Theme.Holo"> 
     <item name="android:popupMenuStyle">@style/PopupMenu.Example</item> 
     <item name="android:dropDownListViewStyle">@style/DropDownListView.Example</item> 
    </style> 

</resources> 

: 시작부터 바로

android:theme="@style/Theme.Example" 

내 응용 프로그램 충돌을 여기 는 style.xml입니다 : S 사용할 수 있기 때문에 어떻게 든 AppCompat 테마가 필요합니다.

import android.support.v7.app.ActionBarActivity; 
import android.support.v7.app.ActionBar; 

확실하지 않습니다. 어떻게하면 ActionBar에 다른 색과 높이 특성을 부여 할 수 있기 때문에 어떻게 수정 할 수 있을까요?

또는 ActionBar를 제거하고 새 툴바를 사용해야합니까? 나는 새로운 재료 디자인에서 그것 이후로 비록 그것을 사용할 수 있는지 확실하지 않으며 Lolipop 및 더 높은 권리를 위해서만인가? 도움

+0

질문에 충돌 로그를 추가하십시오. – AAnkit

+0

귀하의 logcat 출력은 무엇입니까? –

+0

나는 특정 활동에서만 커스텀 테마를 사용하기 위해 treid했다. 그리고 나서 이것으로 crshes한다 : java.lang.IllegalStateException :이 액티비티와 함께 ​​Theme.AppCompat 테마 (또는 자손)를 사용해야한다. – zooky

답변

0

시도 하나 아래로 테마 선언을 교체합니다.

는 프로젝트에서 안드로이드 지원 라이브러리 V7을 추가 네드 수있는이

<style name="Theme.Example" parent="@style/Theme.AppCompat.Light"> 

<style name="Theme.Example" parent="@android:style/Theme.Holo.Light"> 

를 교체합니다.

+0

나는 그랬습니다. 이제는 더 이상 오류가 없지만 테마를 적용하지 않습니다. S i've all drawables 등 ... 내 xml 파일이 맞나요? 아니면 거기도 바꿀 필요가 있습니까? – zooky

+0

이 링크를 사용하여 드로어 블 또는 액션 바 사용자 정의를 생성하십시오. Google 크롬을 사용하십시오. http://jgilfelt.github.io/android-actionbarstylegenerator/ – AAnkit

0

마다 홀로AppCompat으로 바꿉니다. 내가 찾은 곳마다 줄을 의미합니다 홀로으로 변경합니다. AppCompat