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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:25:48+00:00 2026-05-25T16:25:48+00:00

I have a design that I want to position the views into these section

  • 0

I have a design that I want to position the views into these “section” correctly:

enter image description here

The red areas are empty.
The other “areas” should be centered, the green is ImageView, the other two are TextViews.

To make this possible, someone from this site told me I should use layout_weight.. how can I calculate the correct percentage to use?

What I did was: Padding on the red sides, and calculated the rest according to the left space.. but the views werent correct.. the xml i tried:

<?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:orientation="horizontal"
android:layout_height="wrap_content"  android:paddingTop="10dip"    android:paddingBottom="10dip">

<TextView android:id="@+id/Start_Numbering" android:textSize="19.5dip"
    android:layout_width="0dp" android:layout_height="wrap_content"
    android:layout_weight="0.4" 
    android:gravity="center"
    />

<ImageView android:id="@+id/Start_ImageView"
    android:layout_weight="0.11" android:layout_height="wrap_content"
    android:layout_width="0dp" android:src="@drawable/quran_list_noaudioavailable"
    android:gravity="center"
    ></ImageView>


<TextView android:id="@+id/Start_Name" android:textColor="#a7e9fe"
    android:textSize="21dip" android:layout_width="0dp"
    android:layout_weight="0.6"
    android:gravity="center"
    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-25T16:25:49+00:00Added an answer on May 25, 2026 at 4:25 pm

    layout_weight uses a fraction to determine the size of the children:

    child_space = child_weight / total_weight

    where total_weight is the weight sum of all children in the parent layout.

    E.g. if you want to have 3 views, two filling 25% of the width and one filling 50%, assign 1 to the first two and 2 to the second. This results in 1/4 (=25%) of the space for each of the two and 2/4 (= 50%) for the third one.

    (you could also use any other number for the first two and double the first weight for the 3rd view, this cancels down to the above fractions)

    You can also just give numbers below 1 as you did above. As long as the total sum is 1 these are interpreted as percentages (e.g. 0.42 = 42%).

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

Sidebar

Related Questions

I want to change a label that is on my design I have linked
I have a schema design that looks like this: Table: User Row Column Family
So I have this template design that is currently absolutely positioned, but I'm trying
I'm setting up a Magento site and have some design requirements that we can't
I have a system I am trying to design that will retrieve information from
I have an idea for a functional programming language design that makes heavy use
I have a design for a page that uses 3 types of audio and
I have to design a data structure that is to be used in a
I have numerous functions (unknown at design time) that each take a specific number
I have several label boxes on my design form that all share the naming

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.