ScrollView don't scroll?

2019-05-21 05:30发布

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.

2条回答
太酷不给撩
2楼-- · 2019-05-21 05:57

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.

查看更多
老娘就宠你
3楼-- · 2019-05-21 06:18

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

查看更多
登录 后发表回答