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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:14:11+00:00 2026-05-30T08:14:11+00:00

If I have one layout file => res/layout/item.xml : <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android

  • 0

If I have one layout file => res/layout/item.xml :

<?xml version="1.0" encoding="utf-8"?>            
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="60dp"

>

    <TextView
        android:id="@+id/name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="John"
        />

    <TextView  
        android:id="@+id/age"
        android:layout_width="fill_parent"
        android:layout_height="26dip" 
        android:text="29" />
</LinearLayout>

And I have another layout file whose content includes several of above item=> res/layout/main.xml:

<?xml version="1.0" encoding="utf-8"?>            
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="60dp"
        android:orientation="vertical"        
    >

    <!--How can I override "name" and "age" attribute in the included item layout-->        

    <include android:id="@+id/student" layout="@layout/tem" />

    <include android:id="@+id/teacher" layout="@layout/item" />

    <include android:id="@+id/other" layout="@layout/item" />

</LinearLayout>

As you see above, I use <include> tag to include the same layout. But, how can I override the “name” and “age” text value in the included item.xml from main.xml for each included item??

  • 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-30T08:14:13+00:00Added an answer on May 30, 2026 at 8:14 am
    I hope this will work.
    
    View v=(View)findviewbyid(R.id.student);
    
    Textview name=(TextView)v.findviewbyid(R.id.name);
    
    Textview age=(TextView)v.findviewbyid(R.id.age);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this layout file in my android application: <?xml version=1.0 encoding=utf-8?> <TabHost xmlns:android=http://schemas.android.com/apk/res/android
I have the following layout defined for one of my Activities: <?xml version=1.0 encoding=utf-8?>
I have one ImageButton in my xml layout like that : <ImageButton android:id=@+id/tabsButton android:background=@drawable/button
I'm dynamically generating a layout, and to do this I have a menu_row_element.xml file
I have two xml files. One xml file is a Shape and the other
I have a doubt in layouts.I have designed one layout using group layout using
I have a JFrame with null layout and two one character JLabels on the
I have a layout that is working, but it has one very annoying problem..
I am designing custom dialogue in android, For this purpose I designed xml file
I am trying to implement this example http://www.javacodegeeks.com/2011/02/android-google-maps-tutorial.html and i have followed exactly all

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.