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 7814941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:21:54+00:00 2026-06-02T05:21:54+00:00

I am trying to include an existing layout in another layout file (xml). To

  • 0

I am trying to include an existing layout in another layout file (xml). To position those layouts I need to give the included layout an id, so i am able to reference it, e.g.

I am using the following layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/bar"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical">
        ...
</RelativeLayout>

I am including this layout in another layout, like this:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/container"
    android:background="@drawable/bg"
    >
    <include android:id="@id/bar" layout="@layout/bar"/>  

    <ScrollView 
        android:id="@+id/scrollView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/bar"
        >
        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
        android:gravity="center">
       ...
      </LinearLayout>
   </ScrollView>
</RelativeLayout>

This works fine and my ScrollView gets positioned below my bar and I am able to click on the bar, without the click events being intercepted by the ScrollView.

When I am trying to do the same in a different layout file it says that it can´t find the resource @id/bar:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:id="@+id/layoutContainer2"
    >

    <include android:id="@id/bar" layout="@layout/bar"/>

    <ScrollView 
        android:id="@+id/scrollview2"
        android:layout_height="wrap_content"
        android:layout_width="fill_parent"
        android:layout_below="@id/bar"
        >
        <LinearLayout 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:gravity="center">
        ...
</LinearLayout>
</ScrollView>
</RelativeLayout>

Anybody knows why that is?

  • 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-02T05:21:56+00:00Added an answer on June 2, 2026 at 5:21 am

    change android:id="@id/bar" to android:id="@+id/someId"

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

Sidebar

Related Questions

I am trying to include a .js file into a php file. My folder
I am trying to include the Zend_Service_Amazon_S3 file by using require_once 'Zend/Service/Amazon/S3.php'; I have
I am trying to include a variable in a .ini file setting by surrounding
i'm trying to include a number of images in my SWF file not by
I'm trying to take an existing php file which I've built for a page
I'm trying to include a vCard export function in an existing page full of
I'm trying include this barcode source code Stefanhafeneger - Barcode github.com to my project
I'm trying to include the Sparkle framework in my application. I don't really understand
I'm trying to include an image in an email, which is being sent using
I'm trying to include an EPS figure in a document that will be compiled

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.