Good day. You need to make the name of the application in ActionBar not a text, but a beautiful picture. Is it possible to display a picture instead of text in ActionBar ?

    2 answers 2

    In the markup:

     <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_height="@dimen/action_bar_default_height" android:layout_width="match_parent" android:background="@color/primary" android:minHeight="?attr/actionBarSize" android:layout_gravity="top"> <ImageView android:id="@+id/toolbar_logo" android:layout_width="wrap_content" android:layout_height="wrap_content" app:srcCompat="@drawable/logo" /> </android.support.v7.widget.Toolbar> 

    In Activity

     private Toolbar toolbar; @Override protected void onCreate(Bundle savedInstanceState) { toolbar = (Toolbar) findViewById(R.id.toolbar); // Если Ρ…ΠΎΡ‚ΠΈΡ‚Π΅ ΠΈΠ·ΠΌΠ΅Π½ΠΈΡ‚ΡŒ ΠΈΠ»ΠΈ Π½Π°Π·Π½Π°Ρ‡ΠΈΡ‚ΡŒ ΠΊΠ°ΠΊΠΎΠ΅-Π½ΠΈΠ±ΡƒΠ΄ΡŒ дСйствиС logo = (ImageView) toolbar.findViewById(R.id.toolbar_logo); setSupportActionBar(toolbar); } 

    The activity must also inherit from AppCompatActivity.

      You can do this:

       Drawable d=getResources().getDrawable(R.drawable.background_image_name); getActionBar().setBackgroundDrawable(d);