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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:07:49+00:00 2026-05-30T16:07:49+00:00

I have been working on an app to start out on android. I have

  • 0

I have been working on an app to start out on android. I have run into the problem that my layout will not show correctly when it goes to a different orientation other like this:

https://i.stack.imgur.com/0iBxd.jpg

Here is my vertical layout 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"
    android:padding="3dip" >

    <EditText
        android:id="@+id/passText"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="5"
        android:hint="Passcode"
        android:inputType="textPassword" />

    <EditText
        android:id="@+id/messageText"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:gravity="top|left"
        android:hint="Message" >

        <requestFocus />
    </EditText>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="5"
        android:orientation="horizontal"
        android:weightSum="100" >

        <Button
            android:id="@+id/encodeButton"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="50"
            android:text="Encode" />

        <Button
            android:id="@+id/decodeButton"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="50"
            android:text="Decode" />
    </LinearLayout>

</LinearLayout>

Here is my landscape layout 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"
    android:padding="8dip" >

    <EditText
        android:id="@+id/passText"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="2"
        android:hint="Passcode"
        android:inputType="textPassword" >

        <requestFocus />
    </EditText>

    <EditText
        android:id="@+id/messageText"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="2"
        android:gravity="top|left"
        android:hint="Message" />

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="2"
        android:orientation="horizontal"
        android:weightSum="100" >

        <Button
            android:id="@+id/encodeButton"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="50"
            android:text="Encode" />

        <Button
            android:id="@+id/decodeButton"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="50"
            android:text="Decode" />
    </LinearLayout>

</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-30T16:07:50+00:00Added an answer on May 30, 2026 at 4:07 pm

    Try setting your android:layout_height on the items expanding/shrinking to wrap_content. If you read here:

    http://developer.android.com/reference/android/view/ViewGroup.LayoutParams.html#attr_android:layout_height

    It talks about the three possible values and what they do.

    fill_parent: The view should be as big as its parent (minus padding). This constant is deprecated starting from API Level 8 and is replaced by match_parent.

    match_parent: The view should be as big as its parent (minus padding). Introduced in API Level 8.

    wrap_content: The view should be only big enough to enclose its content (plus padding).

    You should be using wrap_content on a couple of those items. Below I added an example of which heights I would have changed for your vertical layout:

    <EditText
        android:id="@+id/passText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="5"
        android:hint="Passcode"
        android:inputType="textPassword" />
    
    <EditText
        android:id="@+id/messageText"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1"
        android:gravity="top|left"
        android:hint="Message" >
    
        <requestFocus />
    </EditText>
    
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="5"
        android:orientation="horizontal"
        android:weightSum="100" >
    
        <Button
            android:id="@+id/encodeButton"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:layout_weight="50"
            android:text="Encode" />
    
        <Button
            android:id="@+id/decodeButton"
            android:layout_width="match_parent"
            android:layout_height="fill_parent"
            android:layout_weight="50"
            android:text="Decode" />
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that has been working with session variables no problem. I
I have a Mono application that should not show on the dock, but will
I have been working on a django app on my local computer for some
I have been working on a Windows Mobile app for a little while now
I have been working on a small php app (400K total). But in the
I have an MFC app which I have been working on for a few
I have been working on test framework, which creates a new app domain to
I have been trying for 4 days to get app-engine and grails working together
I am working on a little WinForm app and have been trying to find
I am working on a web app using C# and asp.net I have been

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.