Why don't the app icon in title bar display when I create an app with Android Studio? -


before created android app eclipse, can display app icon in left side of title bar , please see image aa.png.

now create android app android studio, have add code android:icon="@mipmap/ic_launcher" manifest.xml file, app icon don't display, please see image bb.png, why?

btw, icon can display if replace compile 'com.android.support:appcompat-v7:22.1.1' compile 'com.android.support:appcompat-v7:18.0.0', why? there bugs com.android.support:appcompat-v7:22.1.1 ?

aa.png

enter image description here

bb.png

enter image description here

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"     package="com.example.cuiwei.myapplication" >      <application         android:allowbackup="true"         android:icon="@mipmap/ic_launcher"         android:label="@string/app_name"         android:theme="@style/apptheme" >         <activity             android:name=".mainactivity"             android:label="@string/app_name" >             <intent-filter>                 <action android:name="android.intent.action.main" />                  <category android:name="android.intent.category.launcher" />             </intent-filter>         </activity>     </application>  </manifest>  <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"     android:layout_height="match_parent" android:paddingleft="@dimen/activity_horizontal_margin"     android:paddingright="@dimen/activity_horizontal_margin"     android:paddingtop="@dimen/activity_vertical_margin"     android:paddingbottom="@dimen/activity_vertical_margin" tools:context=".mainactivity">      <textview android:text="@string/hello_world" android:layout_width="wrap_content"         android:layout_height="wrap_content" />  </relativelayout>    apply plugin: 'com.android.application'  android {     compilesdkversion 22     buildtoolsversion "22.0.1"      defaultconfig {         applicationid "com.example.cuiwei.myapplication"         minsdkversion 9         targetsdkversion 22         versioncode 1         versionname "1.0"     }     buildtypes {         release {             minifyenabled false             proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro'         }     } }  dependencies {     compile filetree(dir: 'libs', include: ['*.jar'])     compile 'com.android.support:appcompat-v7:22.1.1' }  <resources>      <!-- base application theme. -->     <style name="apptheme" parent="theme.appcompat.light.darkactionbar">         <!-- customize theme here. -->     </style>  </resources> 

<activity         android:name=".mainactivity"         android:icon="@mipmap/ic_launcher"         android:label="@string/app_name" >         <intent-filter>             <action android:name="android.intent.action.main" />              <category android:name="android.intent.category.launcher" />         </intent-filter> </activity> 

if doesn't work, should call getsupportactionbar().seticon(drawable/int) or getsupportactionbar().setlogo(drawable/int)in activity.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -