2016-12-17 30 views
0

我已经在滚动视图内创建了一个列表视图,列表已经开始滚动,但列表视图下面的linearlayout不会出现在屏幕上。已经使用自定义适配器来填充列表。以下是我的代码,请任何机构帮助我。列表视图不工作滚动查看

<ScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#fff" 
    android:fillViewport="true" 
    > 

    <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:background="#fff" 
     tools:context=".Crew"> 


     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical"> 

      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="vertical" 
       android:padding="16dp" 
       > 

       <ListView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:id="@+id/crew_list" 
        android:layout_marginTop="20dp" 
        ></ListView> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:orientation="vertical" 
        android:layout_alignParentBottom="true" 
        android:layout_gravity="bottom" 
        > 
        <TextView 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:text="MESSAGE" 
         android:fontFamily="Myriad Pro" 
         android:textSize="15dp" 
         android:textColor="#d0d0d0" 
         android:padding="5dp" 
         /> 

        <EditText 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:inputType="textMultiLine" 
         android:textSize="15dp" 
         android:padding="10dp" 
         android:text="" 
         android:gravity="top|left" 
         android:background="@drawable/textarealayout" 
         android:id="@+id/report_cabin_crew" 
         android:lines="3"/> 

        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:layout_marginTop="8dp" 
         android:orientation="horizontal"> 

         <ImageView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:layout_gravity="center" 
          android:src="@drawable/greybox"/> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:text="SEND SMS" 
          android:layout_marginLeft="5dp" 
          android:textColor="#0a3e8d" 
          /> 

        </LinearLayout> 

        <Button 
         android:layout_width="match_parent" 
         android:layout_marginTop="8dp" 
         android:layout_height="wrap_content" 
         android:text="SEND MESSAGE" 
         android:textColor="#fff" 
         android:textSize="18dp" 
         android:background="@drawable/buttonlayout" 
         /> 
       </LinearLayout> 


      </LinearLayout> 

     </LinearLayout> 


    </RelativeLayout> 


</ScrollView> 
+0

可能重复的[滚动视图内的Android列表视图](http://stackoverflow.com/questions/18367522/android-list-view-inside-a-scroll-view) – NilayDani

+0

看到我的答案http:// stackoverflow.com/a/40669978/6478047 – Redman

+0

你不能保持滚动视图内的滚动元素,所以你需要在滚动视图内完全展开列表视图 – Redman

回答

0

你不必滚动对方的布局。当组织你的布局时,你会意识到你可以实现相同的行为,并与其中一个。