Android ScrollView工作不正常

Android ScrollView工作不正常,android,scrollview,Android,Scrollview,我在以下程序中添加的滚动条不能正常工作 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="wrap_content"> <LinearLayout

我在以下程序中添加的滚动条不能正常工作

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="wrap_content">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#D3D3D3">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#FFFFFF"
        android:textSize="20dp"
        android:text="Over the years, Techfest's presence has been felt internationally. The technology that is being promoted has had tremendous impact on all the participants of the festival. This year Techfest provides an international platform to it's participants in some versatile competitions. Such a platform is necessary to promote exchange of ideas and exposure to participants.
Techfest welcomes you to International Challenge, where knowledge crosses borders.
"
        android:textColor="#000000"
        android:layout_marginBottom="8dp"/>
    <LinearLayout
        android:id="@+id/robowars"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#FFFFFF"
        android:clickable="true"
        android:orientation="horizontal"
        android:layout_marginBottom="8dp"
        >

        <ImageView
            android:id="@+id/img"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="5dp"
            android:src="@drawable/bullet_icon" />

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_margin="20dp"
            android:text="RoboWars"
            android:textSize="25dp"
            android:textColor="#000000"/>
    </LinearLayout>
    <LinearLayout
        android:id="@+id/irc"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#FFFFFF"
        android:clickable="true"
        android:orientation="horizontal"
        >

        <ImageView
            android:id="@+id/img1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_marginLeft="5dp"
            android:src="@drawable/bullet_icon" />

        <TextView
            android:id="@+id/textView21"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_margin="20dp"
            android:text="International Robotics Challenge"
            android:textSize="25dp"
            android:textColor="#000000"/>
    </LinearLayout>
</LinearLayout>
</ScrollView>
对于这个文件,滚动条根本不起作用,也就是说,它不滚动。但是对于另一个选项卡,完全相同的逻辑似乎可以正常工作。我应该做什么改变?先谢谢你

编辑


我得到了错误的趋势。它始终不显示文件中的最后一个按钮。希望这有帮助

仅当内容超过屏幕大小时,滚动视图才起作用。有关详细信息,请访问

尝试将父布局添加到滚动视图,即相对布局或线性布局

比如说

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">




//here add your scrollview or other layout watever you have written  above (This is just for referance)
</RelativeLayout>

//在这里添加您的滚动视图或其他布局(仅供参考)

只需更改高度即可填充父对象

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


可能是您的内容,但不超过屏幕大小。只需更改高度以填充父项,其内容应高于它。否。我的内容比屏幕大。“小阳光”,我试过了。还是不行,请把你的内容截图给我。我试过我的预览,它比屏幕小。这个表单有两个按钮,但只有一个是可见的,因为它没有滚动。我的内容超过了屏幕大小。它没有显示“我的xml文件”中的两个按钮之一,但不会向下滚动。现在,它已向下滚动,但仍不会一直向下滚动。@DhanviSreenivasan:它已到达终点。
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
</ScrollView>