android中内置可扩展列表视图的垂直滚动条

android中内置可扩展列表视图的垂直滚动条,android,xml,mobile,Android,Xml,Mobile,我正在用android开发一个应用程序。我在线性布局周围添加了一个垂直滚动条。问题是布局只有半个屏幕可见。我想滚动视图应该覆盖全屏。这是我的全屏布局 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" andr

我正在用android开发一个应用程序。我在线性布局周围添加了一个垂直滚动条。问题是布局只有半个屏幕可见。我想滚动视图应该覆盖全屏。这是我的全屏布局

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

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="0dp"
        android:background="#4ba9d1" >

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight=".5"
            android:src="@drawable/logo" />

        <ImageView
            android:id="@+id/imageButton2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight=".2"
            android:src="@drawable/menu_icon" />
    </LinearLayout>


    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="0dp"
        android:background="#242424"
        android:orientation="vertical" >

<LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dip"
            android:layout_marginRight="20dip"
            android:layout_marginTop="20dip"
            android:background="#363636"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/head_title"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:fontFamily="@string/fonts"
                android:gravity="center_vertical|center_horizontal"
                android:text="AssetTrac - Experience Zone"
                android:textColor="#fff"
                android:textSize="18sp" />
   </LinearLayout> 
   <ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical" >   
<LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dip"
            android:layout_marginRight="20dip"
            android:orientation="vertical" >     
<LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dip"
            android:layout_marginRight="20dip"
            android:layout_marginTop="10dip"
            android:background="#4ba9d1"
            android:orientation="vertical" >
    <ExpandableListView
        android:id="@+id/expandableListView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:divider="@drawable/separ"
        >

    </ExpandableListView>
    </LinearLayout>
    <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="50dp"
            android:layout_marginLeft="20dip"
            android:layout_marginRight="20dip"
            android:layout_marginTop="10dip"
            android:background="#4ba9d1"
            android:orientation="vertical" >
            <EditText
                android:id="@+id/signature"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:ems="20"
                android:inputType="textPostalAddress" />
            <Button
                android:id="@+id/save_sig"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="94dp"
                android:text="Button" />
            <Button
                android:id="@+id/update_status"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="94dp"
                android:text="Button" />


 </LinearLayout>
 </LinearLayout>
 </ScrollView> 
</LinearLayout>


</LinearLayout>
任何帮助我都将不胜感激


谢谢:

在您的ScrollView标签中添加android:fillViewport=true,它将填充整个屏幕

ScrollView父级的线性布局,背景242424高度设置为包裹内容。因此,scrollview高度(即填充父级)将具有内容大小的高度。 将scrollview父对象的高度设置为fill_父对象,或者将scrollview移出立即线性布局标记之外

    <LinearLayout
    android:layout_width="fill_parent"
    <!-- Layout Height set to fill_parent -->
    android:layout_height="fill_parent"
    android:layout_marginTop="0dp"
    android:background="#242424"
    android:orientation="vertical" >

       <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="20dip"
        android:layout_marginRight="20dip"
        android:layout_marginTop="20dip"
        android:background="#363636"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/head_title"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:fontFamily="@string/fonts"
            android:gravity="center_vertical|center_horizontal"
            android:text="AssetTrac - Experience Zone"
            android:textColor="#fff"
            android:textSize="18sp" />
      </LinearLayout> 

      <ScrollView
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:scrollbars="vertical" >  
      ....... 

谢谢你,阿什!。现在显示已满,但现在滚动不起作用:根据您的更正,我还在scrollview中添加了android:fillViewport=true以获得全屏显示,但现在滚动不起作用。您不能简单地将一个垂直滚动项放在另一个滚动视图中。ExpandableListview正在识别该手势,而scrollview无法再捕捉该手势。这是一个已知的问题,在另一个地方找到解决方案。让我知道这是否有效。根据您的更正,我还编辑了scroll view的父级布局高度以填充父级以获得全屏显示。现在全屏显示可用,但现在scroll不工作。是否有任何视图不可见?那么它将如何滚动?ScrollView仅在屏幕上有无法安装的视图时才起作用。