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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:07:20+00:00 2026-06-17T17:07:20+00:00

There is the following code: <LinearLayout android:layout_width=match_parent android:layout_height=0dip android:layout_weight=0.9 android:gravity=center android:orientation=horizontal > <TextView android:id=@+id/activityEvaluationYesterdayValueDisplay

  • 0

There is the following code:

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dip"
            android:layout_weight="0.9"
            android:gravity="center"
            android:orientation="horizontal" >

            <TextView
                android:id="@+id/activityEvaluationYesterdayValueDisplay"
                android:layout_width="15dip"
                android:layout_height="wrap_content"
                android:text="0"
                android:textAppearance="?android:attr/textAppearanceMedium"
                android:textStyle="bold" />

            <com.ulnda.mypsych.views.VerticalSeekBar
                android:id="@+id/activityEvaluationYesterdayValue"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="center"
                android:max="10"
                android:progress="0" />
        </LinearLayout>

Now I need to change LinearLayout to RelativeLayout. If I do it then RelativeLayout fill the whole screen, and it’s bad. I understand that RelativeLayout doesn’t use layout_weight for its work. Please, tell me, how can I fix it? I’ve tried to make LinearLayout wrapper for RelativeLayout, but it doesn’t help.

UPDATE:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dip"
        android:layout_weight="0.6"
        android:orientation="vertical" >

        <RelativeLayout
            android:background="#000000"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >
        </RelativeLayout>

    </LinearLayout>

</LinearLayout>
UPDATE 2: FUll code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <TableRow
            android:id="@+id/tableRow1"
            android:layout_width="match_parent"
            android:layout_height="0dip"
            android:layout_weight="0.5" >

            <LinearLayout
                android:weightSum="1.0"
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="0.33"
                android:orientation="vertical" >

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dip"
                    android:layout_weight="0.9">

                    <TextView
                        android:id="@+id/activityEvaluationYesterdayValueDisplay"
                        android:layout_width="15dip"
                        android:layout_height="wrap_content"
                        android:text="0"
                        android:layout_centerVertical="true"
                        android:layout_toLeftOf="@+id/activityEvaluationYesterdayValue"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textStyle="bold" />

                    <com.ulnda.mypsych.views.VerticalSeekBar
                        android:id="@+id/activityEvaluationYesterdayValue"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:layout_centerInParent="true"
                        android:max="10"
                        android:progress="0" />
                </RelativeLayout>

                <TextView
                    android:id="@+id/TextView05"
                    android:layout_width="match_parent"
                    android:layout_height="0dip"
                    android:layout_weight="0.1"
                    android:gravity="center"
                    android:text="Yesterday"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:textStyle="bold" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="0.33"
                android:orientation="vertical" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dip"
                    android:layout_weight="0.9"
                    android:gravity="center"
                    android:orientation="horizontal" >

                    <TextView
                        android:id="@+id/activityEvaluationTodayValueDisplay"
                        android:layout_width="20dip"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:text="0"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textStyle="bold" />

                    <com.ulnda.mypsych.views.VerticalSeekBar
                        android:id="@+id/activityEvaluationTodayValue"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:max="10"
                        android:progress="0" />
                </LinearLayout>

                <TextView
                    android:id="@+id/TextView03"
                    android:layout_width="match_parent"
                    android:layout_height="0dip"
                    android:layout_weight="0.1"
                    android:gravity="center"
                    android:text="Today"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:textStyle="bold" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="0.33"
                android:orientation="vertical" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dip"
                    android:layout_weight="0.9"
                    android:gravity="center"
                    android:orientation="horizontal" >

                    <TextView
                        android:id="@+id/activityEvaluationTomorrowValueDisplay"
                        android:layout_width="20dip"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:text="0"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textStyle="bold" />

                    <com.ulnda.mypsych.views.VerticalSeekBar
                        android:id="@+id/activityEvaluationTomorrowValue"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:max="10"
                        android:progress="0" />
                </LinearLayout>

                <TextView
                    android:id="@+id/TextView02"
                    android:layout_width="match_parent"
                    android:layout_height="0dip"
                    android:layout_weight="0.1"
                    android:gravity="center"
                    android:text="Tomorrow"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:textStyle="bold" />
            </LinearLayout>
        </TableRow>

        <TableRow
            android:id="@+id/tableRow2"
            android:layout_width="wrap_content"
            android:layout_height="0dip"
            android:layout_weight="0.5" >

            <LinearLayout
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="0.33"
                android:orientation="vertical" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dip"
                    android:layout_weight="0.9"
                    android:gravity="center"
                    android:orientation="horizontal" >

                    <TextView
                        android:id="@+id/activityEvaluationEnergyValueDisplay"
                        android:layout_width="20dip"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:text="0"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textStyle="bold" />

                    <com.ulnda.mypsych.views.VerticalSeekBar
                        android:id="@+id/activityEvaluationEnergyValue"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:max="10"
                        android:progress="0" />
                </LinearLayout>

                <TextView
                    android:id="@+id/TextView11"
                    android:layout_width="match_parent"
                    android:layout_height="0dip"
                    android:layout_weight="0.1"
                    android:gravity="center"
                    android:text="Energy"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:textStyle="bold" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="0.33"
                android:orientation="vertical" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dip"
                    android:layout_weight="0.9"
                    android:gravity="center"
                    android:orientation="horizontal" >

                    <TextView
                        android:id="@+id/activityEvaluationWeatherValueDisplay"
                        android:layout_width="20dip"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:text="0"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textStyle="bold" />

                    <com.ulnda.mypsych.views.VerticalSeekBar
                        android:id="@+id/activityEvaluationWeatherValue"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:max="10"
                        android:progress="0" />
                </LinearLayout>

                <TextView
                    android:id="@+id/TextView09"
                    android:layout_width="match_parent"
                    android:layout_height="0dip"
                    android:layout_weight="0.1"
                    android:gravity="center"
                    android:text="Weather"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:textStyle="bold" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="0dip"
                android:layout_height="match_parent"
                android:layout_weight="0.33"
                android:orientation="vertical" >

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="0dip"
                    android:layout_weight="0.9"
                    android:gravity="center"
                    android:orientation="horizontal" >

                    <TextView
                        android:id="@+id/activityEvaluationHoursSleptValueDisplay"
                        android:layout_width="20dip"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:text="0"
                        android:textAppearance="?android:attr/textAppearanceMedium"
                        android:textStyle="bold" />

                    <com.ulnda.mypsych.views.VerticalSeekBar
                        android:id="@+id/activityEvaluationHoursSleptValue"
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:max="10"
                        android:progress="0" />
                </LinearLayout>

                <TextView
                    android:id="@+id/TextView07"
                    android:layout_width="match_parent"
                    android:layout_height="0dip"
                    android:layout_weight="0.1"
                    android:gravity="center"
                    android:text="Hours Slept"
                    android:textAppearance="?android:attr/textAppearanceMedium"
                    android:textStyle="bold" />
            </LinearLayout>
        </TableRow>
    </TableLayout>

</LinearLayout>

Why RelativeLayout fill whole screen, not 0.6 ?

  • 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-17T17:07:21+00:00Added an answer on June 17, 2026 at 5:07 pm

    RelativeLayout is the only one child who has layout_weight attribute so you should also specify weightSum:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:weightSum="1">
    
        <RelativeLayout
            android:background="#ff0000"
            android:layout_width="match_parent"
            android:layout_height="0dip"
            android:layout_weight="0.6">
    
        </RelativeLayout>
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been developing some Android application and there is the following code: final
Please have a look at the following code <ScrollView xmlns:android=http://schemas.android.com/apk/res/android xmlns:tools=http://schemas.android.com/tools android:layout_width=match_parent android:layout_height=match_parent tools:context=.DisplayResult
I have the following code in resultlookup.xml <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:id=@+id/layoutResultOuter
In the jquery.cycle.js file, there is the following code: $.fn.cycle.transitions.scrollRight = function($cont, $slides, opts)
I have been developing the application for drawing, and there is the following code
Please, explain, why in the following code there is no error: void f() {
My program/process exited abnormally? I doubt something is wrong with the following code: There
I'm reading Eckel's book, IO chapter, and there is the following code (p. 667).
The following code is executing perfectly but there is a mySQL error somewhere that
The following code continues to be displayed even if there are entries in my

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.