Scrollable parent with ListView child

I know it's considered taboo to place a ListView inside a scrolling container, so is there any "proper" way to accomplish scrolling of a container that has a ListView child in it? An example layout would look something like:

Header
---
"Sub" header
---
ListView with list items
---
Footer

Header and Footer need to remain static on the screen, and the middle content (Subheader and ListView) should scroll between them. I can't have just the ListView scrollable, because the subheader takes up too much space. As it is currently, the Header comes from an <include />, the Subheader contains several views including an Image and some text, and the ListView (actually part of a ViewFlipper) would contain an indeterminate number of items. The Footer has a couple buttons/tabs that are used to control the ViewFlipper (only one of the views in the flipper is a ListView).

The only way I can think of to accomplish this efficiently would be to place the Subheader inside the ListView as the first item -- is there any better way?


Asked by: Lily130 | Posted: 20-01-2022






Answer 1

I know it's considered taboo to place a ListView inside a scrolling container

It's not "taboo", it just will never work.

The only way I can think of to accomplish this efficiently would be to place the Subheader inside the ListView as the first item -- is there any better way?

You could use addHeader() on ListView to set up your "Subheader" as a ListView header.

Answered by: Kimberly123 | Posted: 21-02-2022



Similar questions

android - How do I make a Button a part of a scrollable ListView?

I have a ListView with a Button below it. When I fill the list with more content than the screen size allows, so that the scroll bar appears, the Button is not part of the scrollable area. That is, the Button disappears. How do I make the Button part of the scrollable area? &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_widt...


android - Set ListView Scrollable

When I do a ListActivity my ListView works correctly : I can scroll by dragging with the TouchScreen or with the Mouse Wheel. However when I incorporate a ListView in a layout (with buttons, textview, linearLayouts, ect... ) I can't scroll it by dragging, I can just scroll with the mouse wheel. How can I enable the "touch" scroll of a listView (outside a list activity) ?


android - Fixed Button below a scrollable ListView

I have a scrollable ListView with items (like in http://developer.android.com/resources/tutorials/views/hello-listview.html). I am using an ArrayAdapter for the items and use it as a parameter in setListAdapter. Now I would like to add a button at the bottom of the screen, which does not scroll with the list. ...


android - how to make scrollable ListView but not to fill whole screen?

I want to make screen with TextView on top (title) a ListView in the middle and buttons on the bottom. How to place ListView that will fill entire space between top TextView and bottom Buttons and be able to scroll its content ? Now, when my list grows, it pushes bottom button outside the screen. I have: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:...


android - Scrollable ListView and a TextView

I'm little confused playin arround with android layout files. What I wan't to get is this: http://img857.imageshack.us/img857/5939/examplen.jpg Remember that ListView area is scrollable, but the TextView should be always visible on the screen, no matter how long is the list. I tried several methods, last was like:


Not scrollable listview in scroll view android

i need to make a layout that is scrollable, holds a listview that is not scrollable(full height of the content). So when i scroll the content above the listview is showed, and the full listview is displayed. Is this possible in android?


Android - scrollable listview in home screen widget

I've problem, that i want to create a home screen widget with listview inside, which should be scrollable. I read on docs page, that listview is only supported in remoteview from 3.0 android. But still i think, this is not completely true, or i am missing something. Ok, when i tried do add listview to my home screen diget, i get error: class not allowed to be inflated android.widget.listview. BUT on m...


android - How to check if a my ListView has scrollable number of items?

How do you know if your ListView has enough number of items so that it can scroll? For instance, If I have 5 items on my ListView all of it will be displayed on a single screen. But if I have 7 or more, my ListView begins to scroll. How do I know if my List can scroll programmatically?


android - ListView Indicate more scrollable itmes

all i want to do is When the page has more data, there should be some indication like three dots or something like that at the bottom of the page so that user will know there are more records and will scroll it here At the bottom of the page there is no indication that there are more records. i want to add that indication sig...


css - Jquery Mobile Listview not scrollable in android 2.2.2

I have a Jquery Mobile Dialog box as written below: &lt;div data-role="dialog" id="styles" data-theme="a"&gt; &lt;div data-role="header" class="header"&gt; &lt;h1&gt;Styles&lt;/h1&gt; &lt;/div&gt; &lt;!-- /header --&gt; &lt;div data-role="content" data-scroll="true" data-theme="a"&gt; &lt;div class="scroll"&gt; ...


Custom layout in Android: scrollable graphic with selectable elements over top

I'm fairly new to the Android platform and was wondering if I could get some advice for my current head scratcher: I'm making an app which in one view will need an image, which can be scrolled on one axis, with a load of selectable points over the top of it. Each point needs to be positionable on the x and y (unlikely to change once the app is running, but I'll need to fine tune the positions whilst I'm developing...


Android: How to make current layout with scrollable text view?

I tried multiple solution but none seem to work. Layout: -------------------- |btn1| txt1 |btn2| -------------------- | | | | | | | txtview1 | | | | | | | -------------------- btn1 - top left aligned - decrease txt1 btn2 - top right aligned - increase txt1 txt1 - top cent...


Android: make a scrollable custom view

I've rolled my own custom view and can draw to the screen alright, but what I'd really like to do is set the measuredHeigh of the screen to, say, 1000px and let the user scroll on the Y axis, but I'm having problems doing this. Can anyone help? Here's some code: public class TestScreen extends Activity { CustomDrawableView mCustomDrawableView; @Override public void onCreate(Bundle...


java - Android: Creating a Scrollable Layout

I'm trying to create a "scrollable" layout in Android. Even using developers.android.com, though, I feel a little bit lost at the moment. I'm somewhat new to Java, but not so much that I feel I should be having these issues--being new to Android is the bigger problem right now. The layout I'm trying to create should scroll in a sort of a "grid". I THINK what I'm looking for is the Gallery view, but I'm really lo...


android - How to make a scrollable app widget?

As far as I have read in the Internet and official documentation, it isn't possible to make a scrollable app widget. Also all my tries failed. I even tried to subclass TextView to implement my own scroll method, but nothing worked. Are there any ways to achieve that? Btw.... there are solutions if you use for example htc sense or home desktop ++, but i want to make it available to other users which don't us...


Android: Scrollable tabs

I'm currently working on my first android application. I am using a tabbed layout for my application. I followed the tutorial for this on the dev guide and ran into a problem. The tutorial only used three tabs, but I have a need for more. As such, the tabs resize and bunch up. I was hoping someone could tell me how I can make them scroll, like in dolphin browser when using multiple tabs. Thanks! ~aaron


android - How do I make a Button a part of a scrollable ListView?

I have a ListView with a Button below it. When I fill the list with more content than the screen size allows, so that the scroll bar appears, the Button is not part of the scrollable area. That is, the Button disappears. How do I make the Button part of the scrollable area? &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_widt...


Scrollable Android ListView in TableView Row

I have the following layout for a dialog: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/categorylist" android:layout_width="fill_parent" android:layout_height="fill_parent" android:stretchColumns="0"&gt; &lt;TableRow&gt; &lt;ListView android:id="@+id/categorylistview" ...


android - it may sound like a trivial question but who i make my layout scrollable

scrollable meaning by the user touch he can can go up and down in the layout given this is what i did and the emulator throw an exception null pointer somthing and i have problems figuring out from where it comes .... &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;ScrollView&gt; &lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:l...


scroll - Scrollable text in Android widget

I have created a widget to display some long text. I want this text to have "marquee" effect . I've already set TextView propertie ellipsize="marquee" but it doesn't works . Any idea? Edit: For example Stocks widget of HTC






Still can't find your answer? Check out these communities...



Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android



top