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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:32:30+00:00 2026-05-24T07:32:30+00:00

Hi all I am making a game for Android and I need help placing

  • 0

Hi all I am making a game for Android and I need help placing some Views on the screen such that they are proportional to the screen. Consider the following XML code for my 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"    
              android:background="@drawable/background">

<ImageView android:src="@drawable/logo" android:layout_height="wrap_content" android:layout_width="fill_parent" android:id="@+id/logo" ></ImageView>

<FrameLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="2">
    <ScrollView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/buttons">
         <LinearLayout android:id="@+id/main_layout" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal">
            <ImageView 
                android:paddingRight="15dp"
                android:layout_height="wrap_content" 
                android:layout_width="wrap_content" 
                android:src="@drawable/menu_start_button" 
                android:id="@+id/start_button">
            </ImageView>

            <ImageView 
                android:layout_height="wrap_content"                    
                android:layout_width="wrap_content" 
                android:src="@drawable/menu_tutorial_button" 
                android:id="@+id/tutorial_button">
            </ImageView>
         </LinearLayout>
    </ScrollView>

    <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="bottom" android:layout_alignParentRight="true" android:id="@+id/option_buttons">
            <ImageView android:id="@+id/option_sound" android:src="@drawable/option_sound" android:layout_height="wrap_content" android:layout_width="wrap_content" android:paddingRight="5dp" android:paddingBottom="5dp"/>
            <ImageView android:id="@+id/option_vibrate" android:layout_width="wrap_content" android:src="@drawable/option_vibrate" android:layout_height="wrap_content" android:paddingBottom="5dp" android:paddingRight="5dp"></ImageView>
            <ImageView android:id="@+id/option_show_help" android:layout_width="wrap_content" android:src="@drawable/option_show_help" android:layout_height="wrap_content"android:paddingRight="5dp"></ImageView>
    </LinearLayout>
</FrameLayout>

I want the logo (with the id logo) to take up the top 30% of the screen. The FrameLayout takes up the bottom 30% of the screen and has two buttons in the middle (wrapped in the ScrollView with ID buttons) and three option buttons that’s supposed to be on the right side of the FrameLayout (but for some reason it’s on the left side) aligned vertically. The android:layout_weight does not help me solve my problem as I would like to have these Views proportional to the screen. So is there an elegant solution to my problem or would I have to do some tricky magic?

  • 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-24T07:32:32+00:00Added an answer on May 24, 2026 at 7:32 am

    Figured it out. I did have to use the layout_weight attribute after all. I had to set the parent’s weightSum property to 1 and then set all its child elements’ layout_weight so that it’s proportional to the aforementioned weightSum. For example, if the child element has to be 50% of the parent’s height, I set its layout_weight to 0.5 and its layout_height attribute to 0dp.

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

Sidebar

Related Questions

I'm developing an Android game that has to download some assets to the SD
I am making a game that I want compatible for all older devices to
I'm making a game and I need to be able to ship some data
I'm making my first game using Java on Android. I need to draw a
I'm making a website that tend to handle all the request in one page
I'm making a script that goes through a table that contains all the other
im making some script with mechanize.browser module. one of problem is all other thing
I'm planning on making an editor for my current project and will need some
I'm making a game engine in C++. It is supposed to read all its
Making an uno game for a project. all 108 cards are located in a

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.