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

The Archive Base Latest Questions

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

I have an Android 3.0 Application for Tablets. On this application I have to

  • 0

I have an Android 3.0 Application for Tablets. On this application I have to insert several ViewsGroup on a layout, and each of these ViewsGroup has several views.
Here is the onCreate code of the Activity:

    setContentView(R.layout.main);
    params = new LayoutParams(500, 600);
    ViewGroup v1 = new Bar(this);
    this.addView(v1,params);
    ViewGroup v2 = new Bar(this);
    this.addView(v2,params);

This Bar class extends ViewGroup, and has several views inside it. The problem is that only the Views of the first ViewGroup (v1) are being shown on the screen. But I can see that it add both ViewGroup to the content, since for example I can set the background of the second one and i will see the results. But the Views that are inside the second ViewGroup are not being drawn on the screen. I tried to change the order, v2 first, and all views inside v2 got drawn while the ones in v1 didn’t. I think it may have some to do with the onLayout method inside the Bar class, which I’ll put below:

@Override
protected void onLayout(boolean arg0, int arg1, int arg2, int arg3, int arg4) {
    for(int nI = 0; nI < this.getChildCount(); nI++){
        this.getChildAt(nI).layout(arg1, arg2, arg3, arg4);
    }

}

Does this method has any problems?

I’ using a LinearLayout by the way.

<LinearLayout android:background="#C6D7D2" android:orientation="horizontal" android:id="@+id/container" android:layout_width="wrap_content" android:layout_height="wrap_content"> </LinearLayout>
  • 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-25T02:49:47+00:00Added an answer on May 25, 2026 at 2:49 am

    You should override onMeasure() also. You need to set the setMeasuredDimension(w,h) there. w and h are bar’s height and width that you get after adding all its childrens dimensions.

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

Sidebar

Related Questions

I have a Web Service and an Android application that uses this web service.
I have a bunch of EditTexts in my Android application, each with InputMethod set
In my Android application; I have a single database with multiple tables. Each table
We have about 7-8 tables in our Android application each having about 8 columns
I have an Android application with version 1.6 I take the wallpaper and show
I have an Android application that connects to Facebook to request authorization of an
I have two threads in an Android application, one is the view thread, and
I have a screen where you can enable/disable modules for my Android application. For
I have an interesting problem being reported to me from an android application I
I want to integrate the zxing source code to my Android application. I have

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.