Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3946770
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T01:10:22+00:00 2026-05-20T01:10:22+00:00

I am developing an application that contains many activities and i created my own

  • 0

I am developing an application that contains many activities
and i created my own menu (i don’t want to use the built in menu button) with the Sliding Drawer
as the sliding drawer is at the bottom of the screen and contains my menu buttons

what i need is to make that sliding drawer to appear in all my activities

i tried to create an activity and set it’s content view to the xml file that includes the drawer and then extends that activity in all other activities but this solution doesn’t work

so any suggestions ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T01:10:23+00:00Added an answer on May 20, 2026 at 1:10 am

    Extending is the right way. Just override setContentView in the right way.
    Here’s the working example, but instead of drawer, I use a created a custom tabbar:

    Define a layout with your drawer like this:

    this is act_layout.xml

    <LinearLayout
      ...
      android:orientation="vertical"
    >
      <YourDrawer
        ...
      />
      <FrameLayout
        android:id="@+id/act_content"
        ...
      >
        // Here will be all activity content placed
      </FrameLayout>
    </LinearLayout>
    

    This will be your base layout to contain all other layouts in the act_content frame.
    Next, create a base activity class, and do the following:

    public abstract class DrawerActivity extends Activity {
    
        protected LinearLayout fullLayout;
        protected FrameLayout actContent;
    
        @Override
        public void setContentView(final int layoutResID) {
            // Your base layout here
            fullLayout= (LinearLayout) getLayoutInflater().inflate(R.layout.act_layout, null); 
            actContent= (FrameLayout) fullLayout.findViewById(R.id.act_content);
    
            // Setting the content of layout your provided to the act_content frame
            getLayoutInflater().inflate(layoutResID, actContent, true); 
            super.setContentView(fullLayout);
    
            // here you can get your drawer buttons and define how they 
            // should behave and what must they do, so you won't be 
            // needing to repeat it in every activity class
        }
    }
    

    What we do, is basically intercept all calls to setContentView(int resId), inflate our layout for drawer from xml, inflate our layout for activity (by reId provided in method call), combine them as we need, and set as the contentView of the activity.

    EDIT:
    After you’ve created the stuff above, just proceed to write an app as usual, create layouts (without any mention of a drawer) create activities, but instead of extending simple activity, extend DrawerActivity, like so:

    public abstract class SomeActivity extends DrawerActivity {
    
        protected void onCreate(Bundle bundle) {
            setContentView(R.layout.some_layout);
        }
    }
    

    What happens, is that setContentView(R.layout.some_layout) is intercepted. Your DrawerActivity loads the layout you provided from xml, loads a standart layout for your drawer, combines them and then sets it as contentView for the activity.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an application that needs to use regini (because of legacy reasons)
I'm developing an application for Android 1.6 and newer which contains a functionality that
When developing an application that sends out notification email messages, what are the best
I'm developing and application that runs as a Windows service. There are other components
I'm developing an application that manages network interfaces on behalf of the user and
I am actually developing and application that has around 15 modules, all of them
We are developing an application that involves a lot of different tests where each
I am developing RoR application that works with legacy database and uses ActiveScaffold plugin
I'm currently developing an application that is comprised of five separate executables that communicate
I am developing an application that can be extended using plug-ins. The plug-ins will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.