4
<application
    android:allowBackup="true"
    android:icon="@drawable/icon"
    android:label="@string/app_name"
    android:logo="@drawable/logo"
    android:theme="@style/AppTheme" >

This is my androidmanifest.xml

and in mainactivity.java i use this lines to show logo in action bar.

getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setIcon(R.drawable.logo);

after using this two lines in .java file my logo is showing in the display but the app label is gone.... is their any method by which logo & app label both will shown in actionbar after compiling apk.

user4824797
  • 41
  • 1
  • 1
  • 2
  • possible duplicate of [How do I change the android actionbar title and icon](http://stackoverflow.com/questions/14483393/how-do-i-change-the-android-actionbar-title-and-icon) – cygery Apr 23 '15 at 15:05
  • Try to put `android:label="@string/app_name` to your `Activity` – Xcihnegn Apr 23 '15 at 15:32

3 Answers3

2

You not need the two lines in mainactivity.java, you have to select a Theme with the ActionBar:

From res>layout>activity_main.xml(or whatever is the name of the layout of your activity): in the "Design" tab change the theme in "Holo.Light.DarkActionBar" for example.

Or from the AndroidManifest.xml in your app add (or change):

android:theme="@style/AppTheme"

where "AppTheme" is defined in res>values>styles.xml as:

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

Of course in your manifest you have to define the name and logo in the <application> level:

<application
  android:logo="@drawable/logo"
  android:label="@string/app_name"
  android:theme="@style/AppTheme"
...
Sara
  • 1,844
  • 22
  • 18
0

Add this into your Activity in manifest.

<activity
        android:name=".MainActivity"
        android:label="@string/app_name"
</activity>
Akshay Shinde
  • 945
  • 10
  • 23
0

copy your image file and paste it to the res->minmap folder and then goto your AndroidManifest file and locate the below option

android:icon="@mipmap/image_file_name"

give your icon image file name name here (image_file_name) then run your app.

Kalyan Mishra
  • 25
  • 1
  • 7