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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:37:21+00:00 2026-05-30T09:37:21+00:00

This is my xml: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=match_parent android:layout_height=match_parent> <RelativeLayout android:layout_height=fill_parent android:layout_width=fill_parent > <RelativeLayout

  • 0

This is my xml:

 <RelativeLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="match_parent"
 android:layout_height="match_parent">

<RelativeLayout 
android:layout_height="fill_parent" 
android:layout_width="fill_parent"
>

    <RelativeLayout 
    android:layout_height="wrap_content" 
    android:layout_width="fill_parent" 
    android:id="@+id/header"
    android:background="@android:color/white"
    >
        <Button 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content"
        android:id="@+id/btnBack"
        android:text="Back"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:layout_marginLeft="5dp"
        />

        <ImageView 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content"
        android:src="@drawable/icon"
        android:layout_centerInParent="true"
        />

    </RelativeLayout>

    <RelativeLayout 
        android:layout_below="@+id/@+id/header"
        android:layout_height="fill_parent" 
        android:layout_width="fill_parent" 
        android:id="@+id/view" 
        android:layout_above="@+id/footer"
     >
     </RelativeLayout>

     <RelativeLayout
     android:id="@+id/footer" 
     android:layout_height="wrap_content" 
     android:layout_width="fill_parent"
     android:layout_alignParentBottom="true"    
     android:background="@android:color/white"     
     >
        <Button 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content"
        android:id="@+id/btn1"   
        android:text="btn1"
        android:layout_alignParentLeft="true"

        />

        <Button 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content"
        android:id="@+id/btn2"   
        android:text="btn2"
        android:layout_centerHorizontal="true"
        />

        <Button 
        android:layout_height="wrap_content" 
        android:layout_width="wrap_content"
        android:id="@+id/btn3"   
        android:text="btn3"
        android:layout_alignParentRight="true"
        />

     </RelativeLayout>

   </RelativeLayout>
 </RelativeLayout>

the relative layout view is in between the two layouts.
I want to get the size of this relative layout(i.e height and width) in my code.I tried it by using getWidth and getHeight but it is showing 0.
Is there any other way?

  • 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-30T09:37:23+00:00Added an answer on May 30, 2026 at 9:37 am
    import android.app.Activity;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.Button;
    import android.widget.RelativeLayout;
    import android.widget.TextView;
    
    public class AndroidResizeView extends Activity {
    
        TextView textMyTextView;
        Button myButton;
    
        RelativeLayout rlayout;
    
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.hightk);
    
            rlayout = (RelativeLayout) findViewById(R.id.rlayout);
    
            textMyTextView = (TextView) findViewById(R.id.textView1);
    
            myButton = (Button) findViewById(R.id.button1);
    
            myButton.setOnClickListener(new Button.OnClickListener() {
    
                @Override
                public void onClick(View arg0) {
                    // TODO Auto-generated method stub
                    updateSizeInfo();
                }
            });
        }
    
        @Override
        public void onWindowFocusChanged(boolean hasFocus) {
            // TODO Auto-generated method stub
            super.onWindowFocusChanged(hasFocus);
            updateSizeInfo();
        }
    
        private void updateSizeInfo() {
    
            textMyTextView.setText(String.valueOf("Width: "
                    + rlayout.getWidth() + "height ::" + rlayout.getHeight()));
    
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my main.xml:` <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=match_parent android:addStatesFromChildren=false android:layout_height=wrap_content> <TableLayout android:id=@+id/header android:layout_marginRight=2dp android:layout_marginLeft=2dp
<?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent> <org.zestadz.ads.ZestadzAd android:id=@+id/ad android:layout_width=fill_parent android:layout_height=wrap_content android:layout_alignParentBottom=true android:clickable=true
I have a layout like this: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=match_parent android:layout_height=match_parent android:orientation=vertical > <include layout=@layout/basicinfo
i have in xml tis code: <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/mainLayout android:layout_width=wrap_content android:layout_height=wrap_content> <Button android:id=@+id/examp1 android:layout_width=wrap_content
Here's my XML: <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=wrap_content> <WebView android:id=@+id/WebView01 android:layout_width=wrap_content android:layout_height=wrap_content
I have <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:id=@+id/mainRelativeLayout> and I'm trying to setup the background
I've got this RelativeLayout I am using: <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=match_parent
I am dynamically inflating following xml <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=wrap_content android:layout_height=wrap_content android:layout_margin=10dip
I have this XML: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android xmlns:ads=http://schemas.android.com/apk/lib/com.google.ads android:id=@+id/LinearLayout1 android:layout_width=fill_parent android:layout_height=fill_parent android:background=@drawable/fondoverde3
I have an XML layout like this: <?xml version=1.0 encoding=utf-8?> <RelativeLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=match_parent

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.