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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:16:32+00:00 2026-05-25T20:16:32+00:00

Short question: I want the fragment, which is inside a scroll view, to occupy

  • 0

Short question: I want the fragment, which is inside a scroll view, to occupy all the available space. How can I achieve that?

Details: I have a fragment, which I put inside a ScrollView in the parent layout. That scroll view occupies most of the space in the parent layout. Despite that, the fragment appears very small inside the scroll view. The picture illustrates this:

the fragment, or the scroll view, doesn't take the whole space

This is the XML for the fragment:

<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ImagePickerGridView" android:orientation="vertical"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:gravity="center" android:stretchMode="columnWidth"
    android:numColumns="auto_fit" android:horizontalSpacing="5dp"
    android:verticalSpacing="5dp" android:background="@color/orange1">
</GridView>

This is the XML for the parent layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout1" android:orientation="vertical"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:gravity="center" android:stretchMode="columnWidth"
    android:numColumns="auto_fit" android:horizontalSpacing="5dp"
    android:verticalSpacing="5dp">
    <ScrollView android:layout_width="match_parent"
        android:id="@+id/imagePickerScrollView" android:layout_weight="1.0"
        android:layout_height="match_parent" android:background="@color/orange1" android:layout_gravity="fill_vertical">
    </ScrollView>
    <LinearLayout android:id="@+id/linearLayout3"
        android:layout_width="match_parent" android:layout_height="wrap_content"
        android:background="@color/blue1">
        <Button android:layout_height="wrap_content"
            android:layout_width="wrap_content" android:layout_weight="1.0"
            android:text="@string/ImportSelectedButton" android:id="@+id/importSelectedButton"
            android:layout_marginLeft="@dimen/standardMargin"
            android:layout_marginTop="@dimen/standardMargin"
            android:layout_marginBottom="@dimen/standardMargin" android:onClick="onImportSelected"></Button>
        <Button android:layout_height="wrap_content"
            android:layout_width="wrap_content" android:layout_weight="1.0"
            android:text="@string/CancelButton" android:id="@+id/cancelButton"
            android:layout_marginRight="@dimen/standardMargin"
            android:layout_marginTop="@dimen/standardMargin"
            android:layout_marginBottom="@dimen/standardMargin" android:onClick="onCancel"></Button>
    </LinearLayout>
</LinearLayout>

And finally, this is how I add the fragment to the activity:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_picker_1);

    Log.d(CLASS_NAME, "onCreate");

    m_multiPicSelect = getIntent().getBooleanExtra(IntentHelper.MULTI_SELECT, false);
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();

    Fragment fragment = new ImagePickerFragment();
    fragmentTransaction.add(R.id.imagePickerScrollView, fragment);
    fragmentTransaction.commit();
}
  • 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-25T20:16:32+00:00Added an answer on May 25, 2026 at 8:16 pm

    OK, I found out what was the problem. Turns out that GridView is a scrollable container, so there was no need to put it inside a ScrollView. Once I put the grid view inside a linear layout, everything worked! I still have no idea why the GridView shrank itself inside the ScrollView, maybe because shouldn’t have been there in the first place 🙂

    Thanks everybody for your answers!

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

Sidebar

Related Questions

The short version of this question is: How can I take data that only
I have a short question. I want do put this \tssr>&\8=f23' into a String
my question is , I want to get some short and smart ideas to
This question is sort of a sequel to that question. When we want to
Short question - how do you define your view models? Here are some of
Short question: Is the parent of an entity group included in that entity group
Short question: I'm trying to make that in a given page (uses tabs) back
Short Question I have a loop that runs 180,000 times. At the end of
The short question is - how can I prevent (delay) a bound UI element
Short question is: how can i use graph api oauth redirects mechanism to authenticate

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.