• Home
  • AI
  • DSA
  • iOS
  • Flutter
  • Android
    • Jetpack
    • Android Tutorials
    • Android development
    • Android Kotlin
  • 5G
  • 4G LTE
    • IoT
  • E-learning
  • Blog
  • Streaming
Monday, February 2, 2026
  • Home
  • AI
  • DSA
  • iOS
  • Flutter
  • Android
    • Jetpack
    • Android Tutorials
    • Android development
    • Android Kotlin
  • 5G
  • 4G LTE
    • IoT
  • E-learning
  • Blog
  • Streaming
subscribe
subscribe to my newsletter!

"Get all latest content delivered straight to your inbox."

[mc4wp_form id="36"]
Codeplayon
Codeplayon
  • Home
  • AI
  • DSA
  • iOS
  • Flutter
  • Android
    • Jetpack
    • Android Tutorials
    • Android development
    • Android Kotlin
  • 5G
  • 4G LTE
    • IoT
  • E-learning
  • Blog
  • Streaming
HomeAndroid developmentHow to create a transparent action bar with a back button
Mar. 26, 2020 at 4:59 am
Android developmentAndroid tutorial

How to create a transparent action bar with a back button

6 years agoApril 29, 2020
1.6kviews

Hii Everyone in the Android Article I am working with Actionbar. In this tutorial, you can learn How to create a transparent action bar with a back button. Also, you can learn how to use the Action bar title for the screen.

Android Working with an Action bar to How to create a transparent action bar with a back button.

  • Add Action Bar Title,
  • Android Actionbar Logo
  • Android Actionbar BackPreesed Button,
  • Actionbar Notification Icons
  • Action Bar With SearchView.
  • Transparent Action bar.
  • Android  ACTION_BAR_OVERLAY

Android How to Add Title in Action_Bar.

androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(true);
actionBar.setTitle("codeplayon");

Android How to Add Icon in Action_Bar.

Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setIcon(R.drawable.action_icons);

Android How to Add Back button in ActionBar.

androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setTitle("Articles ");

And Create a Meth to target your back pressed Activity.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
        case android.R.id.home:
            //Write your logic here
            Intent intent=new Intent(Current_Activity.this, Home_Activity.class);
            startActivity(intent);
            finish();
        default:
            return super.onOptionsItemSelected(item);
    }
}

Android how to Add Notification Icons in ActionBar.

 @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        MenuInflater inflater = getMenuInflater();
        inflater.inflate(R.menu.action_main, menu);
        final View notificaitons = menu.findItem(R.id.action_Notification).getActionView();
        itemMessagesBadgeTextView = (TextView) notificaitons.findViewById(R.id.badge_textView);
        IconButton iconButtonMessages = (IconButton) notificaitons.findViewById(R.id.badge_icon_button);
        iconButtonMessages.setTextColor(getResources().getColor(R.color.White));
        iconButtonMessages.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                Intent intent =new Intent(Home_Activity.this, Notifications.class);
//                startActivity(intent);

            }
        });

        return true;
    }

Create a Menu XML file and add menu icons.

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".MainActivity">


    <item
        android:id="@+id/action_search"
        android:orderInCategory="100"
        android:title="Search"
        android:icon="@drawable/icons_search"
        app:showAsAction="ifRoom"></item>
    <item
        android:id="@+id/action_Notification"
        android:orderInCategory="200"
        android:title="Notification"
        app:actionLayout="@layout/notification"
        app:showAsAction="ifRoom"></item>
</menu>

Create a Notification Count and Icons Layout file.

 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingRight="5dp"
    android:orientation="vertical">
    <TextView
        android:id="@+id/badge_textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="10"
        android:padding="3dp"
        android:layout_marginLeft="20dp"
        android:gravity="center"
        android:textColor="#FFF"
        android:textSize="11sp"
        android:background="@drawable/count" />

    <com.joanzapata.iconify.widget.IconButton
        android:layout_width="30dp"
        android:layout_height="30dp"
        android:textColor="@color/White"
        android:background="@drawable/icons_notification"
        android:id="@+id/badge_icon_button"/>
</RelativeLayout>

Android how to add searchView in Actionbar.

public class Home extends AppCompatActivity implements SearchView.OnQueryTextListener{

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.search_bar, menu);
    // Retrieve the SearchView and plug it into SearchManager
    final SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.search_view));
    SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE);
    searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
    searchView.setOnQueryTextListener(this);

    return true;
}

@Override
public boolean onQueryTextSubmit(String query) {
    return false;
}
@Override
public boolean onQueryTextChange(String newText) {
    if(rAdapter==null){
    }else {
        String text = newText;
        rAdapter.filter(text);
    }
    return false;
}

Create a Menu layout file

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <item
        android:id="@+id/search_view"
        android:icon="@drawable/icons_search"
        android:title="search"
        app:actionViewClass="androidx.appcompat.widget.SearchView"
        app:showAsAction="ifRoom|collapseActionView" />
</menu>

Android Transparent Action bar with ACTION_BAR_OVERLAY.

public class Blog_Details extends AppCompatActivity {

    Button Share_BlogBtn;
    FragmentManager fm = getSupportFragmentManager();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        supportRequestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
        setContentView(R.layout.activity_blog__details);

        androidx.appcompat.app.ActionBar actionBar = getSupportActionBar();
        actionBar.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        actionBar.setHomeButtonEnabled(true);
        actionBar.setDisplayHomeAsUpEnabled(true);
        final Drawable upArrow = getResources().getDrawable(R.drawable.baseline_arrow_back_24);
        upArrow.setColorFilter(Color.parseColor("#FFFFFF"), PorterDuff.Mode.SRC_ATOP);
        getSupportActionBar().setHomeAsUpIndicator(upArrow);
        actionBar.setTitle(Html.fromHtml("<font color='#FFFFFF'>Blog Details</font>"));
    }

Android Action Bar custom Icons and Title Color.

final Drawable upArrow = getResources().getDrawable(R.drawable.baseline_arrow_back_24);
upArrow.setColorFilter(Color.parseColor("#FFFFFF"), PorterDuff.Mode.SRC_ATOP);
getSupportActionBar().setHomeAsUpIndicator(upArrow);
actionBar.setTitle(Html.fromHtml("<font color='#FFFFFF'>Blog Details</font>"));

 

Tags :Action Bar With SearchViewActionbar Notification IconsAdd Action Bar TitelAndroid  ACTION_BAR_OVERLAYAndroid Actionbar BackPreesed ButtonAndroid Actionbar LogoAndroid Transparent Action bar with ACTION_BAR_OVERLAY.Android Working with an Action barHow to create transparent actionbar with actionbar back pressedTransparent Action bar.
share on Facebookshare on Twitter
Shivam MalikMarch 26, 2020

Shivam Malik

Welcome to my blog! I’m Ritu Malik, and here at Codeplayon.com, we are dedicated to delivering timely and well-researched content. Our passion for knowledge shines through in the diverse range of topics we cover. Over the years, we have explored various niches such as business, finance, technology, marketing, lifestyle, website reviews and many others. Pinay Viral sfm compile AsianPinay taper fade haircut Pinay flex Pinay hub pinay Viral Fsi blog com pinay yum pinayyum.com baddies hub asianpinay.com tech crusader
view all posts
How to used Recycler View with Swipe Refresh in AndroidX
How To open a DialogFragment in activity Android tutorial

You Might Also Like

DDMS and AIDL in Android Development
Android development

Understanding DDMS and AIDL in Android Development

Shivam Malik
abd
Android development

What is Android Debug Bridge (ADB)?

Shivam Malik
How to Handle Background Tasks in an Android Application
Android development

How to Handle Background Tasks in an Android Application

Shivam Malik
components are Services and Broadcast Receivers.
Android development

What is the Difference Between a Service and a Broadcast Receiver in Android?

Shivam Malik
Android compose Layouts example
Android development

Understanding the Purpose and Usage of LayoutInflater in Android

Shivam Malik
What is Android & history of android
Android development

How to Implement Localization in an Android Application: A Comprehensive Guide

Shivam Malik

Get Even More

"Get all latest content delivered straight to your inbox."
[mc4wp_form id="36"]

latest posts

Joinpd.con code
E-learning

JoinPD Explained: What It Is, How It Works, and How to Join a Class Easily

Shivam Malik
240.6k
DisneyPlus.com Login
Streaming

DisneyPlus.com Login – How to Sign In & Activate Disney+

Shivam Malik
460
Linus Torvalds Vibe Coding
Blog

Linus Torvalds Vibe Coding: The Real Meaning Explained

Shivam Malik
201
2579xao6 Code Bug
technology

2579xao6 Code Bug Explained: Causes, Fixes & Safety

Shivam Malik
154

find me on socials

Search

Contact Info

Contact information that feels like a warm, friendly smile.

Email:Info.codeplayon@gmail.com
Website:Codeplayon

popular posts

Joinpd.con code

JoinPD Explained: What It Is, How It Works, and How to Join a Class Easily

2 weeks agoJanuary 19, 2026
rice purity test

What is your Rice Purity Test Score: Check Score – 2025

1 year agoDecember 22, 2025
Disneyplus.com/begin

Disneyplus.com Begin Guide – Activate Disney Plus Fast

1 month agoDecember 22, 2025
Sitemap.Html
  • JoinPD Explained: What It Is, How It Works, and How to Join a Class Easily
  • DisneyPlus.com Login – How to Sign In & Activate Disney+
  • Linus Torvalds Vibe Coding: The Real Meaning Explained
  • 2579xao6 Code Bug Explained: Causes, Fixes & Safety
  • StartupBooted Forex Explained : Legit or Just Learning?
Codeplayon
  • Privacy Policy

Copyright © 2024 Codeplayon | NewsMozi Asian Pinay.com Taper Fade Haircut sfm compile club Asian Pinay pinayhub.com pinayflex.com pinay Viral Fsi blog com