• Home
  • AI
  • DSA
  • iOS
  • Flutter
  • Android
    • Jetpack
    • Android Tutorials
    • Android development
    • Android Kotlin
  • 5G
  • 4G LTE
    • IoT
  • E-learning
  • Blog
  • Streaming
Wednesday, September 24, 2025
  • 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.5kviews

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
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

picuki codeplayon.com
Blog

Picuki – Best Instagram Viewer & Instagram Downloader 2025

Shivam Malik
2.7k
What Is Redeepseek Com
technology

Redeepseek Com: The Future of Smarter Tech Insights

Shivam Malik
627
What is single sign-on (SSO)
AI

What is SSO Single Sign-On? | How It Works & Benefits

Shivam Malik
772
Android 16’s New Orientation Rules (2)
Android Kotlin

Android 16’s New Orientation Rules | The End of Portrait-Only Apps: Adapting

Shivam Malik
785

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

How to get Pear Deck Join Code For JoinPD.con 2025?

1 month agoAugust 15, 2025
rice purity test

What is Rice Purity Test Score Meaning: Check Score [2025]

9 months agoAugust 28, 2025
Disneyplus.com/begin

How to Activate Disneyplus.com begin account 2025

2 months agoAugust 4, 2025
Sitemap.Html
  • Picuki – Best Instagram Viewer & Instagram Downloader 2025
  • Redeepseek Com: The Future of Smarter Tech Insights
  • What is SSO Single Sign-On? | How It Works & Benefits
  • Android 16’s New Orientation Rules | The End of Portrait-Only Apps: Adapting
  • CPSB LaunchPad: Enhancing Educational Access and Engagement
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