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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T11:00:25+00:00 2026-05-19T11:00:25+00:00

I am new to android and have been looking for a solution to this

  • 0

I am new to android and have been looking for a solution to this but so far no luck. I would like to create a layout that is something like the picture below.

I would like to have a linearLayout that is the size of the screen.Then have another linearLayout that is also the size of the screen but off screen. I can then scroll between the two virtual “screens”.

enter image description here

There is an interesting article that explained how to extend the scrollView class so that I could get a cool snapping effect, so if I can get this to work, my app will feel much like scrolling between home screens.

I have read about weights and also about scrollView’s fillViewport=”true”. I am afraid that I don’t understand how these can be used with a horizontalScrollView to have the linearLayouts fill the screen. I have attempted all kinds of combinations of fill_parent and wrap_content but to no avail.

As I see it, this functionality will not hurt the portability of the app between devices that have different screens as long as I build the sub views (the elements in each “screen”) with screen variability in mind.

Here is a simple example of the XML I was trying:

<HorizontalScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/HorizontalScrollView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fillViewport="true">

<LinearLayout 
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <LinearLayout 
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <EditText
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:id="@+id/txtTestBox"
            >
        </EditText>
    </LinearLayout>

    <LinearLayout 
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">

        <Button
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="Button 1"
        />

    </LinearLayout>

</LinearLayout>

</HorizontalScrollView>

Unfortunately, that does not even get close to what I am looking for. Hopefully this can be done…

Thanks for any help or suggestions.

  • 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-19T11:00:26+00:00Added an answer on May 19, 2026 at 11:00 am

    A horizontal scroll view can scale infinitely side to side, so “Fill Parent” most likely won’t work like you expect on the internal layouts. Have you tried explicitly specifying a width on the internal layouts?

    Something like:

    <HorizontalScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/HorizontalScrollView01"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:fillViewport="true">
    
    <LinearLayout 
        android:orientation="horizontal"
        android:layout_width="400dp"
        android:layout_height="fill_parent">
    
    .....
    
    </LinearLayout>
    
    
    </HorizontalScrollView>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm very new to programming in Android, but have been struggling all day with
I have been looking over some of the android source, and the examples given
I'm new here. I have been trying to create a video capture app using
I am trying to create a simple 3-D app for android that will have
I am new to Android development and have been following the tutorials available on
I am a new to developing for Android and have been reading up and
I am absolutely new to the Android platform and have been building an application
I hope this isn't too off topic for this forum, but I have been
I have been trying to create a simple application that will let the user
I'm quite new to Android and have been using an AVD to debug my

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.