Android 안드로이드2014. 11. 30. 01:19

액션바 적용 유무에 따른 styles.xml  파일 내용

Actionbar를 API 11이상, API 7 이상으로 했을 때에 따른 styles.xml파일 내용 변경 점.


2일간 지우고 깔고 임포트하고 수차례 반복을 했다.


이클립스와 ADT 그리고 업데이트도 새로 받아서 설치했다.

기본 애플리케이션과 액티비티에 적용된 기본 테마는 Holo.Light.DarkActionBar이다.

이 테마는 안드로이드 프로젝트를 만들 때 기본 값으로 선택되는 theme이다.




[values 폴더] 

API 11+


<style name="AppBaseTheme" parent="android:Theme.Light">

<style name="AppTheme" parent="AppBaseTheme">


API 7+

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">

<style name="AppTheme" parent="AppBaseTheme">


------------


[values-v11 폴더]

API 11+

<style name="AppBaseTheme" parent="android:Theme.Holo.Light">


API 7+

<style name="AppBaseTheme" parent="Theme.AppCompat.Light">


-----------------


[values-v14 폴더]

API 11+

<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">


API 7+

<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">



------------------


<resources>

    <!-- the theme applied to the application or activity -->

    <style name="CustomActionBarTheme"

           parent="@android:style/Theme.AppCompat">

        <item name="android:windowActionBarOverlay">true</item>


        <!-- Support library compatibility -->

        <item name="windowActionBarOverlay">true</item>

    </style>

</resources>



똑같은 에러를 만났다.

android:windowActionBarOverlay requires API level 11 (current min is 7)




아래 두 줄을 추가하면 해결된다.

<resources xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android">

<item tools:targetApi="11" name="android:windowActionBarOverlay">true</item>



다른 방법으로는

<resources xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android">

<item name="android:windowActionBarOverlay" tools:ignore="NewApi">true</item>

와 같이 작성하면 되겠다



styles.xml에서 부모를 접두어 "android:"를 빼고 아래와 같이 둔다

parent="@style/Theme.AppCompat"



 그리고 Androidmenifest.xml에서

android:minSdkVersion="7"


마지막으로

    <application

        android:allowBackup="true"

        android:icon="@drawable/ic_launcher"

        android:label="@string/app_name"

        android:theme="@style/AppTheme" >


.........

</application>

으로 해서 AppTheme를 불러주었으나 여전히도 이해할 수 없는 오류가 니오고 있다.




Posted by 코드버무려