2

I've a ScrollView / RelativeLayout / FrameLayout and I inside put programmaticaly some widgets.

Here is the gui xml :

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:background="@drawable/fond_app">
  <RelativeLayout
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  >
   <TextView
   android:id="@+id/titreAppli"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="My Big Application" 
   android:textStyle="bold"
   android:textColor="#9b9b71"
   android:textSize="15dp"
   />
   <FrameLayout
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:id="@+id/out"
   android:layout_below="@id/titreAppli"
   />
  </RelativeLayout>
</ScrollView> 

In the FrameLayout, I put programaticaly another RelativeLayout, and other widgets inside.

With some widgets (text, image, buttons), I can't scroll. With other (a linearlist with text), I can scroll.

Why ? Is there a solution ?

Thanks.

Istao
  • 7,425
  • 6
  • 32
  • 39
  • might be a stupid(I mainly program in opengl on android) question but is there enough to scroll?(I mean is your inner view big enough to need scrolling) – Jason Rogers Dec 15 '10 at 07:24
  • Yes, I think, because I see some widgets beyond the bottom of the window. – Istao Dec 15 '10 at 07:30

2 Answers2

4

First remove frame layout. You should use some other layout like relative instead of framelayout. Becasue Framelayout is not expanding and there fore scroll view is not working. If you use linear or relative then they will expand and you will be able to scroll.

Umakant Patil
  • 2,227
  • 6
  • 32
  • 58
  • Thanks. Unfortunately it's don't work for me : If I replace FrameLayout with RelativeLayout, I see same thing : no scroll on some view that protrude from the window. – Istao Dec 15 '10 at 08:08
3

Have you tried without the android:fillViewport="true" ?

Vit Khudenko
  • 28,288
  • 10
  • 63
  • 91
  • Yes, it may not seem that obvious even after reading the original documentation - http://developer.android.com/intl/zh-CN/reference/android/widget/ScrollView.html#setFillViewport%28boolean%29 . – Vit Khudenko Dec 15 '10 at 09:32
  • I didn't use LinearLayout inside scrollview(because some reasons so I used an extension class of ViewGroup) and I also can't scroll, why? – Kevin Duong Aug 21 '12 at 09:22
  • @KiemDuong: Please ask a separate SO question on this, posing your code. – Vit Khudenko Aug 21 '12 at 20:09