2016-12-17 43 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

你不必滾動對方的佈局。當組織你的佈局時,你會意識到你可以實現相同的行爲,並與其中一個。