无法滚动

问题描述:

请看看以下的Android XML文件,该文件是负责创建GUI无法滚动

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent"> 


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <TextView 
     android:id="@+id/textView2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/imageTitle" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="14dp" 
     android:text="@string/imageDate" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 

    <ImageView 
     android:id="@+id/imageView1" 
     android:layout_width="match_parent" 
     android:layout_height="254dp" 
     android:layout_weight="0.34" 
     android:src="@drawable/test_image" /> 

    <TextView 
     android:id="@+id/textView3" 
     android:layout_width="fill_parent" 
     android:layout_height="136dp" 
     android:text="@string/imageDescription" /> 

</LinearLayout> 
</ScrollView> 

我试图滚动整个屏幕,但它没有发生。上传的图片将清楚地向您说明。为什么它不滚动?我是android新手,这是我的第二个应用程序。请帮忙! Inside eclipseInside Android run

+0

使用'wrap_content'您的LinearLayout – Praveenkumar 2012-07-27 06:01:57

+0

实际上它需要WRAP_CONTENT即使我们给FILL_PARENT我猜。因为在我的应用程序中,当我使用fill_parent时,它会要求使它成为wrap_content,而我没有,它仍然正常工作 – 2012-07-27 06:05:58

更改使用WRAP_CONTENT这2这样

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" > 


<TextView 
    android:id="@+id/textView3" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/imageDescription" /> 
+1

它工作正常!非常感谢您的帮助! – 2012-07-27 06:19:40

我想你应该在的LinearLayout

使用滚动视图,如果u有整个视图是滚动的,使用滚动视图作为父级布局并使用这样的代码。

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:fillViewport="true"> 

这里android:fillViewport="true"这是允许u到填满整个屏幕布局重要组成部分。如果有其他问题问。

至于android.developer说,对fillViewport Defines whether the scrollview should stretch its content to fill the viewport.

+0

感谢您的建议。我会记住:) – 2012-07-27 06:20:21