GeekedOut
GeekedOut

Reputation: 17185

Android - How to enable full page scrolling on a layout with a ListView?

I have a layout with a ListView. The list scrolls fine, but sometimes the other content on the page needs to be bigger and either the list or the other content take up too much of the screen so I need it all to scroll.

Can that be done?

Here is the layout I have so far:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        >

<include android:id="@+id/header"
         layout="@layout/header"
         android:layout_height="wrap_content"
         android:layout_width="fill_parent"/>    

<TextView
    android:id="@+id/view_name"    
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Business:"
    />       

<TextView
    android:id="@+id/business_privacy"    
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Loading..."
    />     

<TextView
    android:id="@+id/think"    
    android:layout_width="fill_parent"
    android:layout_marginTop ="5dp"
    android:textColor="@color/light_best_blue"
    android:paddingLeft="10px"   
    android:layout_height="wrap_content"
    android:text="Fill out each section below"
    />     

    <ListView
    android:id="@android:id/list"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@+id/label"
        android:textSize="20px"
       >        
    </ListView>

</LinearLayout>

What would be the way to make it easy for the user to be able to see both the text and the list even if the text takes up the whole screen? Can I make the text scrollable? It is especially bad in horizontal view so I think there must be some ux patters to make it play nicely.

Thanks for the advice!

Upvotes: 0

Views: 1350

Answers (2)

Dheeresh Singh
Dheeresh Singh

Reputation: 15701

1- Put textview which has a larger text in header of the list view so it get scroll with list...

or

2- put the textview in other scroll view with fixed size like 1/3 of the screen.

Upvotes: 1

BDFun
BDFun

Reputation: 551

You could either make the content wrap, or wrap the content up using a HorizontalScrollView. Android docs on it can be found here.

Upvotes: 1

Related Questions