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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:17:57+00:00 2026-06-17T22:17:57+00:00

I have a FrameLayout, containing various overlayed ImageViews: <FrameLayout android:id=@+id/australia_frame android:layout_width=match_parent android:layout_height=match_parent> <ImageView android:id=@+id/australia

  • 0

I have a FrameLayout, containing various overlayed ImageViews:

<FrameLayout
    android:id="@+id/australia_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ImageView
        android:id="@+id/australia"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/map_australia"
        />
    <ImageView
        android:id="@+id/nsw"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/map_nsw"
        android:visibility="invisible"
        />
    <ImageView
        android:id="@+id/victoria"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/map_victoria"
        android:visibility="invisible"
        />
        ...etc...
</FrameLayout>

In my code I try and render my FrameLayout:

final Dialog dialog = new Dialog((Context) parent);
dialog.setContentView(R.layout.dialog_region);

FrameLayout fl = (FrameLayout) dialog.findViewById(R.id.australia_frame);
final int height = fl.getHeight();
Validate.isTrue(height > 0);

My code crashes with:

java.lang.IllegalArgumentException: The validated expression is false
    at org.apache.commons.lang3.Validate.isTrue(Validate.java:180)

The line that’s crashing is Validate.isTrue(height > 0);.

Why does my FrameLayout not have a height? Is there a way to get the exact px height and width that my FrameLayout is rendering at?

  • 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-17T22:17:58+00:00Added an answer on June 17, 2026 at 10:17 pm

    This may help you

         FrameLayout target = (FrameLayout) dialog.findViewById(R.id.australia_frame);
        target.post(new Runnable() {
    
            @Override
            public void run() {             
                int width = target.getWidth();
                                int height = width/2;
                /*your code with width and height*/
            }
    
        });
    }   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is maddening. I have the following XML layout: <FrameLayout android:layout_width=fill_parent android:layout_height=wrap_content android:background=@drawable/shadow android:focusable=true
I have frame layout: <FrameLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=match_parent android:layout_margin=10dp > <LinearLayout android:id=@+id/widgetView android:layout_width=match_parent android:layout_height=match_parent
I have this FrameLayout: <FrameLayout android:layout_width=wrap_content android:layout_height=wrap_content android:id=@+id/searchresult_picture_layout android:background=@drawable/img_bkgd_results_patch> <ProgressBar android:layout_width=20dp android:layout_height=20dp android:layout_gravity=center android:id=@+id/searchresult_progressbar
I have this element in my layout XML: <FrameLayout android:id=@+id/FrameLayout01 android:layout_width=320sp android:layout_height=380sp android:layout_gravity=center android:background=#99CC33>
I have a TextView in a FrameLayout as follows: <FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content" ... >
Here is a simple layout: <RelativeLayout android:layout_width=match_parent android:layout_height=wrap_content> <ImageView android:id=@+id/companyIcon android:layout_width=wrap_content android:layout_height=40dp <!-- notice
i have an root_layout : <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical android:background=@drawable/background android:weightSum=10> <FrameLayout android:id=@+id/parentViewHolder
I have an activity with below layout <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=horizontal > <FrameLayout
I have a FrameLayout as follows (both android:src attributes refer to .png files in
In my foo_layout.xml file I have a subclassed RelativeLayout: <?xml version=1.0 encoding=utf-8?> <FrameLayout xmlns:android=http://schemas.android.com/apk/res/android

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.