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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:22:06+00:00 2026-06-09T17:22:06+00:00

I’m arranging elements on a layout, but if I use Linear Layout, everything lines

  • 0

I’m arranging elements on a layout, but if I use Linear Layout, everything lines up along the left. If I set gravity of some elements to be "center", for example, some texts, then on a phone, it looks ok. But if is a pad, then the whole view lies on the left side leaving large area on the right.

So how can I make the view in the center on any devices?

The second question is: If I set the text to be longer, then some words disappear (since they are out of the layout). How can I make the words lie in the center with several lines if necessary instead of being just one really long line and some part outside the view?

problem_layout.png

<?xml version="1.0" encoding="utf-8"?>
<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:background="#FFFFFF"
    android:layout_gravity="center">

    <TextView
        android:id="@+id/text"
        android:layout_column="0"
        android:layout_columnSpan="2"
        android:layout_gravity="right"
        android:layout_row="0"
        android:layout_rowSpan="3"
        android:ems="10" />

    <RadioGroup
        android:id="@+id/first_radiogroup"
        android:layout_column="0"
        android:layout_columnSpan="3"
        android:layout_gravity="bottom"
        android:layout_row="1"
        android:layout_rowSpan="3" >

        <RadioButton
            android:id="@+id/1_1"
            android:text="1_1" />

        <RadioButton
            android:id="@+id/1_2"
            android:text="1_2" />

        <RadioButton
            android:id="@+id/1_3"
            android:text="1_3" />
    </RadioGroup>

    <TextView
        android:id="@+id/firsttext"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_column="2"
        android:layout_row="2"
        android:shadowColor="#000000"
        android:shadowDx="1"
        android:shadowDy="1"
        android:shadowRadius="1.5"
        android:text="please choose from the below:"
        android:textColor="#000000"
        android:textSize="40px"
        android:textStyle="normal"
        android:typeface="serif" 
        android:gravity="center"/>

    <RadioGroup
        android:id="@+id/secon_radiogroup"
        android:layout_column="0"
        android:layout_gravity="bottom"
        android:layout_row="3"
        android:layout_rowSpan="3" >

        <RadioButton
            android:id="@+id/2_1"
            android:text="2_1" />

        <RadioButton
            android:id="@+id/2_2"
            android:text="2_2" />

        <RadioButton
            android:id="@+id/2_3"
            android:text="2_3" />
    </RadioGroup>

    <TextView
        android:id="@+id/secondtext"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_column="1"
        android:layout_columnSpan="2"
        android:layout_row="5"
        android:shadowColor="#000000"
        android:shadowDx="1"
        android:shadowDy="1"
        android:shadowRadius="1.5"
        android:text="please choose from the below:"
        android:textColor="#000000"
        android:textSize="40px"
        android:textStyle="normal"
        android:typeface="serif" />

    <Button
        android:id="@+id/final"
        android:layout_column="2"
        android:layout_row="6"
        android:text="final" />

    <Space
        android:layout_width="1dp"
        android:layout_height="21dp"
        android:layout_column="0"
        android:layout_row="0" />

    <Space
        android:layout_width="1dp"
        android:layout_height="20dp"
        android:layout_column="0"
        android:layout_row="4" />

    <Space
        android:layout_width="1dp"
        android:layout_height="174dp"
        android:layout_column="0"
        android:layout_gravity="fill_horizontal"
        android:layout_row="5" />

    <Space
        android:layout_width="1dp"
        android:layout_height="70dp"
        android:layout_column="0"
        android:layout_row="6" />

    <Space
        android:layout_width="213dp"
        android:layout_height="1dp"
        android:layout_column="2"
        android:layout_row="0" />

    <Space
        android:layout_width="104dp"
        android:layout_height="1dp"
        android:layout_column="0"
        android:layout_row="0" />

    <Space
        android:layout_width="3dp"
        android:layout_height="1dp"
        android:layout_column="1"
        android:layout_row="0" />

    <Space
        android:layout_width="1dp"
        android:layout_height="26dp"
        android:layout_column="0"
        android:layout_row="1" />

    <Space
        android:layout_width="1dp"
        android:layout_height="166dp"
        android:layout_column="0"
        android:layout_row="2" />

</GridLayout>
  • 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-09T17:22:07+00:00Added an answer on June 9, 2026 at 5:22 pm

    You should make different layout file for different screen size.
    here below link may help you

    http://developer.android.com/training/basics/supporting-devices/index.html

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but

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.