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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:56:31+00:00 2026-06-10T20:56:31+00:00

I give. I’m trying to extend the TableLayout class ( simply so I can

  • 0

I give.

I’m trying to extend the TableLayout class ( simply so I can override the onMeasure ) and I’m inflating a TableLayout that’s defined in XML.

The TableLayout shows up (I can see it, due to its custom background) but the TableRows don’t.

Even in the XML “Graphical Layout” of eclipse, if I force the TableLayout to be my custom extended class (com.example.MainApplication.TableLayout_Schedrunning) the nested TableRows aren’t there.

However, if I change the XML to just be TableLayout, the TableRows magically appear.

<?xml version="1.0" encoding="utf-8"?>
<!-- this doesn't work-->
<com.example.MainApplication.Tablelayout_Schedrunning xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/frmlay_schedule"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="15dp"
android:layout_marginTop="15dp"
android:padding="2dp"
android:background="@drawable/schedrunning_background" >
<TableRow 
    android:id="@+id/tblrow_header"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="10dp"
    android:layout_marginLeft="5dp"
    >
    <TextView 
        android:id="@+id/txtSchedRunningHeader"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Schedule Running"
        android:textColor="@android:color/white"
        android:textSize="13dp"/>

    <TextView 
        android:id="@+id/txtCurrScheduleRunning"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="@android:color/white"
        android:textSize="11dp"/>
</TableRow>

</com.example.MainApplication.Tablelayout_Schedrunning>

So again, to reiterate — if I change the above custom class to the simple <TableLayout>, the nested TextViews in the TableRow show up. If I don’t, they don’t.
What simple thing am I missing??

Oh, and the TableLayout is a pretty standard extension:

public class Tablelayout_Schedrunning extends TableLayout {

public Tablelayout_Schedrunning(Context context) {
    super(context);
    Log.w("tablelayout","simple context");
    // TODO Auto-generated constructor stub
}

public Tablelayout_Schedrunning(Context context, AttributeSet attrs) {
    super(context, attrs);
    Log.w("tablelayout","advanced, context and attrs");
    // TODO Auto-generated constructor stub
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    // TODO Auto-generated method stub
    int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
    int parentHeight = MeasureSpec.getSize(heightMeasureSpec);

    Log.w("tablelayout","parentWidth is " + parentWidth);
    Log.w("tablelayout","parentHeight is " + parentHeight);
    //super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    setMeasuredDimension(parentWidth, (int) (parentHeight * .4));
}
  • 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-10T20:56:32+00:00Added an answer on June 10, 2026 at 8:56 pm

    I think you should add super.onMeasure and setLayoutParams to your extention of a View

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

Sidebar

Related Questions

Give the following XML I'm trying to update the UpgradeImage and TargetImage SourceFile attributes
give some idea about lazy loading,so that i can load more than 20 images
give me some links, that will give me a clue what XML documents are
Kindly give me some example that how we can use INSERT INTO ALL STATEMENT
To give an example of the kind of request that I can't figure out
Give the following XML I am trying to split the contents of the extra
Give a linear-time algorithm to test whether a tree has a perfect matching, that
Give a base class Base , I want to write a method Test, like
Give an Image component, how can I tell the size [width and height] of
Give that I have written a JPanel with many different components on it, is

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.