It does not display the icon in the application, what to do?
I tried to add this way, but it did not work.
With this method, only changed the application icon in the menu.

It does not display the icon in the application, what to do?
I tried to add this way, but it did not work.
With this method, only changed the application icon in the menu.

 
    
     
    
    no.1 change bar to toolbar then
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  getSupportActionBar().setDisplayShowHomeEnabled(true);
no.3 mainfest->change icon
  <application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
 
    
    Create toolbar_actionbar.xml as below:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/colorPrimary"
app:contentInsetEnd="0dp"
app:contentInsetLeft="0dp"
app:contentInsetRight="0dp"
app:contentInsetStart="0dp">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ImageButton
        android:id="@+id/imgbtn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:background="@android:color/transparent"
        android:src="@mipmap/ic_launcher" />
    <TextView
        android:id="@+id/txt_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="16dp"
        android:layout_marginStart="16dp"
        android:layout_toEndOf="@+id/btn_back"
        android:layout_toRightOf="@+id/btn_back"
        android:text="Weather"
        android:textColor="@android:color/white"
        android:textSize="20sp"
        android:textStyle="bold" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
Add the above layout in your main layout file by using below lines:
 <include
        android:id="@+id/toolbar"
        layout="@layout/toolbar_actionbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"></include>
In your style, write below lines in your parent theme:
<item name="android:windowActionBar">false</item>
<item name="windowNoTitle">true</item>
And add below lines to your activity:
Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ImageButton imgbtn=(ImageButton)toolbar.findViewById(R.id.imgBtn);
