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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:49:40+00:00 2026-06-10T23:49:40+00:00

I have a Listview inside a Scrollview and manually binding its data on the

  • 0

I have a Listview inside a Scrollview and manually binding its data on the code behind. My main problem is, when I bind my data, my listview isn’t expanding its height. I’ve tried setting it to wrap_content, fill_parent but nothing works. Here is my XML

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/parentScrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content" >

<RelativeLayout
>

<LinearLayout >

    <ImageView
        />

    <LinearLayout
         >

        <TextView />

        <TextView />

        <LinearLayout >

            <TextView/>

            <TextView/>
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <TextView/>

            <TextView />
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

<View />

<TextView/>

<ScrollView
    android:id="@+id/childScrollView"
    android:layout_width="match_parent"
    android:layout_height="375dp"
    android:layout_below="@+id/view1"
    android:layout_centerHorizontal="true"
    android:layout_marginLeft="10dip"
    android:layout_marginRight="10dip"
    android:layout_marginTop="18dp"
    android:background="@drawable/scrollviewborder"
    android:scrollbarStyle="insideInset" >

    <ListView
        android:id="@+id/listFriends"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="2dip"
        android:paddingLeft="2dip"
        android:paddingRight="2dip"
        android:paddingTop="2dip"
        >
    </ListView>


</ScrollView>

<Button />

</RelativeLayout>

</ScrollView>

Please see that it is a nested ListView and here is my code behind

    ArrayList<HashMap<String, String>> friendList = new ArrayList<HashMap<String, String>>();
    // adding database values to HashMap key => value
    for (int i = 0; i < friendName.length; i++) {
        // creating new HashMap
        HashMap<String, String> friend = new HashMap<String, String>();
            //merchant.put(KEY_ID, merchantIdArray[i]); 
            friend.put(KEY_FRIEND_NAME, friendName[i]);
            friend.put(KEY_THUMB_URL,imageIDs[i]);
        friendList.add(friend);
    }

    list=(ListView)findViewById(R.id.listFriends);
     adapter =new LazyAdapter(this, friendList);        
     list.setAdapter(adapter);

What seems to be the problem?

EDIT
Ive added this code for validating which scroll should be used

    parentScrollView= (ScrollView) findViewById(R.id.parentScrollview);
    parentScrollView.setOnTouchListener(new View.OnTouchListener() {

        public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
             //Log.v(TAG,"PARENT TOUCH");
             findViewById(R.id.childScrollView).getParent().requestDisallowInterceptTouchEvent(false);
            return false;
            }
        });
    childScrollView= (ScrollView) findViewById(R.id.childScrollView);
    childScrollView.setOnTouchListener(new View.OnTouchListener() {

        public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
             //Log.v(TAG,"PARENT TOUCH");
             findViewById(R.id.childScrollView).getParent().requestDisallowInterceptTouchEvent(true);
            return false;
        }
    });

The main reason about this is that I will put my Facebook friendlist inside this Listview that it should be scrollable

  • 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-10T23:49:42+00:00Added an answer on June 10, 2026 at 11:49 pm

    The problem is the following (as stated here by Romain Guy):

    Using a ListView to make it not scroll is extremely expensive and goes
    against the whole purpose of ListView. You should NOT do this. Just
    use a LinearLayout instead.

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

Sidebar

Related Questions

I have a DropDownList inside in ListView.. I wanted to get a data when
Possible Duplicate: Format Date in Bind Statement inside a ListView I have modified a
i have problem getting text from edittext inside listview when im in last edittext
I have a ListView inside a AlertDialog, the problem I am having is that
I am having trouble with a scrolling ListView inside a ScrollView . I have
I have a ListView filled with for loop. The data inside ListView is now
In XAML I have a ScrollView and a ListView inside. <ScrollViewer Margin=0, 0, 0,
I have a popup with a listview inside: <Popup Name=PopupResultados Width=200 PlacementTarget={Binding ElementName=textBoxBuscar} AllowsTransparency=True
Possible Duplicate: Listview inside ScrollView is not scrolling on Android I have a ListView
I have Activity with ListView inside it and in the onCreate method of the

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.