2014-12-02 3 views
5

Android 소재 디자인 개념을 처음 사용합니다. 나는 새로운 프로젝트를 만들고 pre-lollipop 버전에 대한 AppCompat 지원과 함께 소재 테마를 추가했지만 Lollipop에서는 ActionBar 일명 툴바를 보여 주지만, 만약 내가 이전 롤리팝에서 동일하게 실행한다면 ActionBar를 보여주지 않습니다.Android 소재 디자인 AppCompat

API 버전에 상관없이 내 레이아웃에서 어디서나 툴바 컨트롤을 사용해야합니까?

편집 :

<!-- Base application theme for prelollipop --> 
<style name="AppTheme" parent="Theme.AppCompat.Light"> 
    <item name="colorPrimary">@color/primary_dark</item> 
    <item name="colorPrimaryDark">@color/primary_dark</item> 
</style> 

<!-- Material theme for lollipop--> 
<style name="AppTheme" parent="android:Theme.Material.Light"> 
    <item name="android:colorPrimary">@color/primary</item> 
    <item name="android:colorPrimaryDark">@color/primary_dark</item> 
</style> 
+2

https://github.com/antoniolg/MaterialEverywhere 그 중 하나를 살펴보십시오. –

+0

레이아웃, 스타일, 코드를 –

+0

@Gabriele Mariotti별로 중요하지 않습니다. 그것은 실제 애플 리케이션에 구현하기 전에 수표로서 물질적 인 주제로 놀기위한 기본 프로젝트였습니다. 질문이 편집되었습니다 – Kirk

답변

-1

ActionBarActivity를 확장해야이

<style name="FamilyDashboardTheme" parent="Theme.AppCompat.Light.NoActionBar"> 

    <!-- Customize your theme here. --> 
    <item name="colorPrimary">@color/familycolor</item> 
    <item name="colorPrimaryDark">@color/familydarkcolor</item> 
    <item name="colorAccent">@color/familycolor</item> 
    <item name="android:textColorPrimary">@android:color/white</item> 
    <item name="android:windowBackground">@android:color/white</item> 
</style> 
1

활동을하려고합니다. 특별한 v21 스타일을 버릴 수 있습니다.

스타일이 Theme.AppCompat 또는 Theme.AppCompat.Light 인 경우 자동으로 기본 작업 표시 줄이 있어야합니다. 스타일이 ...NoActionBar으로 확장되는 경우에는 LOLLIPOP처럼 레이아웃에서 지정해야합니다. 두 번째는 툴바 테마에 대한 세부적인 제어를 제공합니다.

+0

ActionBarActivity는 더 이상 사용되지 않습니다. 대신 {@link android.support.v7.app.AppCompatActivity}를 사용하십시오. –

관련 문제