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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:52:29+00:00 2026-06-01T23:52:29+00:00

The layout_weight attribute in the last TextView in this layout is being highlighted by

  • 0

The layout_weight attribute in the last TextView in this layout is being highlighted by lint as causing bad performance. I suspect the name of the lint warning is erroneous as there are no nested weights. There are several stretching views, and I suspect what it means is dependent weighted views.

What’s the solution, to build this layout, and avoid this lint warning, and improve performance?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="vertical"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:gravity="center_horizontal"
          android:background="@drawable/background_gradient"
    >
<ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/image4"
        android:layout_margin="6dp"
        android:contentDescription="@string/PLACEHOLDER_TEXT"
        />
<LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="horizontal"
        >
    <Button
            style="@style/dashboard_button"
            android:id="@+id/home_management"
            android:text="@string/ICON_MANAGEMENT"
            />
    <Button
            style="@style/dashboard_button"
            android:id="@+id/home_calculators"
            android:text="@string/ICON_CALCULATORS"
            />
</LinearLayout>
<LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="horizontal"
        >
    <Button
            style="@style/dashboard_button"
            android:id="@+id/home_guidelines"
            android:text="@string/ICON_GUIDELINES"
            />
    <Button
            style="@style/dashboard_button"
            android:id="@+id/home_faq"
            android:text="@string/ICON_FAQ"
            />
</LinearLayout>
<LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="horizontal"
        >
    <Button
            style="@style/dashboard_button"
            android:id="@+id/home_refs"
            android:text="@string/ICON_REFERENCES"
            />
    <Button
            style="@style/dashboard_button"
            android:text=""
            android:visibility="invisible"
            />
</LinearLayout>
<LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:gravity="center_vertical"
        android:layout_margin="6dp"
        >
    <TextView
            android:text="@string/HOMEPAGE_CONTENT"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:gravity="center_horizontal"
            android:textStyle="bold"
            android:textColor="#FFFFFF"
            />
    <View
            android:layout_width="8dp"
            android:layout_height="1dp"
            />
    <ImageView
            android:id="@+id/home_logo"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:src="@drawable/image7"
            android:contentDescription="@string/PLACEHOLDER_TEXT"
            />
</LinearLayout>
<Button
        android:id="@+id/home_web_site"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/HOMEPAGE_FOOTER"
        android:paddingLeft="4dp"
        android:paddingRight="4dp"
        android:paddingTop="8dp"
        android:paddingBottom="8dp"
        android:textSize="12sp"
        android:background="@drawable/button_red"
        android:layout_margin="6dp"
        android:textColor="#FFFFFF"
        />
</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-06-01T23:52:31+00:00Added an answer on June 1, 2026 at 11:52 pm

    The TextView and ImageView in your @string/HOMEPAGE_CONTENT area are nested in their parent LinearLayout and have weights assigned. I suspect those are your problem, especially since the parent is wrap_content, so theoretically there shouldn’t be any space for the child elements to stretch into.

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

Sidebar

Related Questions

I have written a couple layout files where I used the layout_weight attribute to
I have a linear layout with two textView. First textView has weight 40 and
I have a textview and edittext in a linear layout. Neither view shows up
I have this simple layout: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical >
How can I set the value for the attribute layout_weight for button in android
I am trying to build an android layout using layout_weight to fit all sizes
hi I have a activity with three vertical linear layout with respective layout_weight with
Maybe I misunderstood the layout_weight parameter but I can't get it why something like
In LinearLayout we can populate elements horizontally by using Layout_Weight which makes them occupy
Is it possible to do a 1:3:6 weight adjustment using relative layout? 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.