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

  • SEARCH
  • Home
  • 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 8274371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:42:54+00:00 2026-06-08T07:42:54+00:00

I got a xml layout file like this: <?xml version=1.0 encoding=utf-8?> <LinearLayout android:id=@+id/tabBar android:layout_width=fill_parent

  • 0

I got a xml layout file like this:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout
    android:id="@+id/tabBar"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#474747"
    android:orientation="horizontal" >

    <ImageButton
        android:id="@+id/BtnSlide"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:background="@null"
        android:src="@drawable/lin" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:text="SteriaFIT Mobile"
        android:gravity="center"
        android:paddingLeft="12dp"
        android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>

<RelativeLayout
android:background="#41413F"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
    <LinearLayout
        android:id="@+id/some_layout_item"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

</LinearLayout>

<View
    android:layout_below="@id/some_layout_item"
    android:layout_width="fill_parent"
    android:layout_height="5dip"
    android:background="@drawable/drop_shadow">
</View>

<ListView android:id="@+id/list" android:layout_width="match_parent" android:layout_height="wrap_content"
    android:background="#FFFFFF" android:cacheColorHint="#FFFFFF">
</ListView>


<Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="To Next Activity" />

I only want to get the tabBar layout from this file into another xml layout file, i do this by including after @+id this way:

<include android:id="@+id/tabBar" layout="@layout/horz_scroll_app" />

but it seems to me that this line of code will include the whole layout file?

EDIT

should mention that this method will also give me the Button with the id button1

EDIT 2

Ok, so after putting the tabBar inside a new layout file like this:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/tabBar"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:background="#474747"
  android:orientation="horizontal" >

    <ImageButton
        android:id="@+id/BtnSlide"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:background="@null"
        android:src="@drawable/lin" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:text="SteriaFIT Mobile"
        android:gravity="center"
        android:paddingLeft="12dp"
        android:textAppearance="?android:attr/textAppearanceMedium" />

</LinearLayout>

and included this to my orginal xml layout like this:

 <include  layout="@layout/tab_bar" android:id="@+id/tabBar" />

it seems to me that I cant register any OnClickListener to my ImageButton inside my tabBar layout. What I tried to do:

 View app = inflater.inflate(R.layout.tab_bar, null);
 ViewGroup tabBar = (ViewGroup) app.findViewById(R.id.tabBar);

btnSlide = (ImageButton) tabBar.findViewById(R.id.BtnSlide);
btnSlide.setOnClickListener(new ClickListenerForScrolling(scrollView, menu));

Can anybody give me a hint=

  • 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-06-08T07:42:55+00:00Added an answer on June 8, 2026 at 7:42 am

    Include is used to include the whole xml file into the current layout. If you only want tabBar path then put them into a separate layout file then include them into the original view as well.

    You will access the view normally:

    LinearLayout tabBar = (LinearLayout) findViewById(R.id.tabBar);
    ImageButton btnSlide = (ImageButton) tabBar.findViewById(R.id.BtnSlide);
    

    I believe, the whole putting views together part is done when compile. So you treat it as you normally would to a view in xml layout.

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

Sidebar

Related Questions

In My Application, My XML layout is like this: <RelativeLayout android:layout_width=fill_parent android:layout_height=fill_parent> <View class=com.project.twsbi.FingerPaint$MyView
I've got the following layout XML file: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/main_layout android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical> <GridView
I have a layout file( layout/my_test.xml ): <TextView android:id=@+id/my_title android:gravity=left|center_vertical android:layout_width=wrap_content android:layout_height=fill_parent /> My
I've got the following button in my xml layout file... <Button android:layout_width=150dip android:id=@+id/button1 android:layout_height=50dip
I've got my AdMob code implemented into my XML file like this: <?xml version=1.0
I've got XML that looks like this: <item> <itemDate>07/10/2009</itemDate> </item> I would like to
I got this XML file: <Msg UserText=start 0> </Msg> <Msg UserText=A> </Msg> <Msg UserText=A>
I've been racking my head with this... I've got a localized strings.xml file in
I've got a problem concerning android layouts. In my xml file I have two
I've got a simple android layout consisting of a scrollview containing a tablelayout. This

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.