2016-06-15 3 views
0

내 주요 활동 FragmentActivity를 확장하고 내가 기본 응용 프로그램 테마를 사용하는 경우, 액션 바 가 사라이 사라집니다. 이유가 무엇입니까?

스타일 : 매니페스트의 스타일

<!-- Base application theme. --> 
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
    <!-- Customize your theme here. --> 
    <item name="android:windowActionBar">true</item> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <item name="colorAccent">@color/colorAccent</item> 
</style> 

:

안드로이드없이

enter image description here

: 안드로이드 매니페스트의 테마 = "@ 스타일/AppTheme".

enter image description here

나는 FragmentActivity을에 getActionBar() 쇼()를 사용하려고 그러나 단순히 null을 반환합니다. 왜 이런 일이 발생하며 작업 표시 줄 스타일을 사용하려면 어떻게해야하나요?

+0

"style in manifest"설명 하시겠습니까? 액션 바는 Theme에 의해서만 제어됩니다. – pdegand59

+1

FragmentActivity가 AppCompatActivity로 변경되면 ... getSupportActionBar()도 사용하십시오. show(); –

답변

1

FragmentActivity를 확장하는 대신 AppCompatActivity를 확장하기 위해 기본 클래스가 필요합니다.

자세한 내용은 That

0

는 매니페스트에 테마를 사용이

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

같이하십시오. 여기를 참조하십시오 : http://coderzpassion.com/android-working-with-material-design/

관련 문제