2015-02-01 5 views
0

Android 애플리케이션을 프로그래밍 중이며 처음부터 아이콘이 작업 표시 줄에 표시되지 않습니다. 이미 많은 솔루션을 읽었거나 적용했지만 표시되지 않습니다. 저를 도와주세요?Android : 아이콘이 ActionBar에 표시되지 않습니다.

Manifest.xml :

(...) 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
(...) 

styles.xml :

(...) 
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> 
     <item name="android:icon">@drawable/ic_launcher</item> 
    </style> 

나는 다음과 같은 구성을 사용하고 있습니다 :

defaultConfig { 
    applicationId "com.converter.android.converter" 
    minSdkVersion 11 
    targetSdkVersion 21 
    versionCode 1 
    versionName "1.0" 
} 
+4

"이미 많은 솔루션을 읽었거나 적용했지만 표시되지 않습니다."- [this like] (http://stackoverflow.com/a/)의 복제본으로 폐쇄 될 것입니다. 26850864/115145) ** 당신이 시도한 것을 완전하고 정확하게 ** 설명하지 않은 경우. – CommonsWare

+0

@CommonsWare, 나는 ** style.xml **에서 parent = "Theme.AppCompat.Light.DarkActionBar"를 변경하려고 시도했습니다. ActionBar actionBar = getActionBar(); 또한 시도했습니다. actionBar.setIcon (R.drawable.ic_launcher) 그러나 이것은 API 14에만 가능합니다. – porthfind

+0

이것은 내가 사용하고있는 테마와 관련이 있다고 생각합니다. – porthfind

답변

0

또한 시도 액션 바 액션 바 = getActionBar(); actionBar.setIcon (R.drawable.ic_launcher)하지만 테마에서 알 수 있듯이 당신이 appcompat-v7를 사용하는 경우이 API 14

으로 만 가능합니다, 당신은 당신의 ActionBarActivity하지 getActionBar()getSupportActionBar()를 호출합니다.

1

응용 프로그램에서 AppCompat 테마를 사용하는 경우 응용 프로그램 아이콘이 작업 표시 줄에 표시되지 않습니다.

재질 디자인으로 된 Google 앱을 볼 수 있듯이 ActionBar에는 앱 아이콘이 없습니다.

하지만 앱 아이콘을 추가하려면 툴바를 사용하고 액션 바를 숨기십시오.

+0

감사합니다 !!! 첫 번째 문장은 AppCompat 테마에 대한 의구심을 표시합니다. 그것으로 솔루션을 찾을 수있었습니다. 이것은 내 문제에 대한 해결책이었다 : getSupportActionBar(). setIcon (R.drawable.ic_launcher); getSupportActionBar(). setDisplayShowHomeEnabled (true); – porthfind

관련 문제