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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:46:32+00:00 2026-05-25T12:46:32+00:00

I have a layout that contains a custom layout. I would like to pass

  • 0

I have a layout that contains a custom layout. I would like to pass the style from one element to another. I have a class which inflates the layout, which I can post if required. This element of design is added by 2 different layouts, with different sizes depending on what is required.

Child layout

<TableLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal">
    <TableRow android:layout_height="wrap_content" android:gravity="center_horizontal" android:layout_width="fill_parent" android:id="@+id/tableRow1">
        <Button android:text="1" android:id="@+id/nb1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="40sp" android:layout_margin="1dip" android:minWidth="70dip"></Button>
        <Button android:text="2" android:id="@+id/nb2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="40sp" android:layout_margin="1dip" android:minWidth="70dip"></Button>
        <Button android:text="3" android:id="@+id/nb3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="40sp" android:layout_margin="1dip" android:minWidth="70dip"></Button>
    </TableRow>
</TableLayout>

And here’s the parent layout

Parent Layout

<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
    <pearsonartphoto.AJEG.number_viewer android:id="@+id/numberviewer" style="@style/bigViewer" android:layout_alignParentRight="true" android:layout_alignParentBottom="true">
    </pearsonartphoto.AJEG.number_viewer>
</RelativeLayout>

What I would like to do is to pass in a style, and have the style be repeated through all of the children, or at least the textView elements. What do I need to do to make this happen?

  • 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-25T12:46:32+00:00Added an answer on May 25, 2026 at 12:46 pm

    As far as I know there is no way in android to inherit the style of parent to the children views, not by just nesting them !

    the thing that you could to is to apply a style to the parent
    let say styleA, and than apply a style to the children elements let say styleB

    and the inheritance could be done in the styles, I mean styleB can inherit properties from styleA and also override some of his parent values

    fill_parent
    wrap_content
    #00FF00
    monospace

    fill_parent
    wrap_content
    #00FF00
    monospace

    the bad news is that you must put style in every children element 🙁

    I think this is the only way to give a style to some element, if you want to give a style to group of elements than you must define theme and apply it to the activity or to the application this is done usually in code but it could be done pro programmaticlly also.

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

Sidebar

Related Questions

I have list view with custom row layout (list_row.xml) that contains CheckBox element: <TableLayout
I have a basic website nav layout that looks like this: <li class=folder parent_folder>
I have a linear layout that contains 6 images, which span the linear layout
I have a layout that is working, but it has one very annoying problem..
I have a Custom ListView that contains a vertical LinearLayout of horizontal LinearLayouts for
I have a custom notification that uses a LinearLayout that contains an ImageView and
I have a listview that contains values from webservice.Each page contains only 10 listitems
I have an Android app that I would like to convert to an Android
On Android, I would like to create a button that contains some other Views.
I have a ViewController that contains a UITableView in which the cells are created

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.