2014-02-07 90 views
1

使用完整佈局滾動展開列表視圖存在問題。如何使用父佈局滾動可展開列表視圖

我正在嘗試創建一個註冊頁面,其中包含用戶名和密碼等文本字段,以及圖片中顯示的可擴展列表視圖。

enter image description hereenter image description here

瞬間加載頁面可以看到在底部註冊新按鈕,但如果我按在擴展列表視圖,直到我崩潰我的列表視圖我不能向下滾動至底部。

以下是我附帶的這個佈局文件。

<?xml version="1.0" encoding="utf-8"?> 

<LinearLayout 
      xmlns:android="http://schemas.android.com/apk/res/android" 

      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="10dip"> 

      <!-- Full Name Label --> 
      <TextView android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:textColor="#372c24" 
       android:text="Full Name"/> 

      <EditText android:id="@+id/reg_fullname" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="5dip" 
       android:singleLine="true" 
       android:layout_marginBottom="20dip"/> 
      <!-- Email Label --> 
      <TextView android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:textColor="#372c24" 
       android:text="Email"/> 

      <EditText 
       android:id="@+id/reg_email" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="20dip" 
       android:layout_marginTop="5dip" 
       android:ems="10" 
       android:singleLine="true" > 

       <requestFocus /> 
      </EditText> 

      <!-- Password Label --> 
      <TextView android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:textColor="#372c24" 
       android:text="Password"/> 

      <EditText android:id="@+id/reg_password" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:password="true" 
       android:singleLine="true" 
       android:layout_marginTop="5dip"/> 

     <ExpandableListView 
     android:id="@+id/cat_listView" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
     </ExpandableListView> 
      <!-- Register Button --> 

     <Button 
       android:id="@+id/btnRegister" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="10dip" 
       android:text="Register New Account" /> 


      <!-- Link to Login Screen --> 

      <TextView 
       android:id="@+id/link_to_login" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginBottom="40dip" 
       android:layout_marginTop="40dip" 
       android:gravity="center" 
       android:text="Already has account! Login here" 
       android:textColor="#025f7c" 
       android:textSize="20dip" /> 

</LinearLayout> 

我想知道,佈局文件可能存在什麼問題?提前致謝。

回答

0

把它們放在兩個不同的佈局。 也就是說,我建議有:

- RelativeLayout 
    -- ScrollView android:layout_alignParentTop="true" android:above="@+id/layout1" 
    --- LinearLayout (basically what you have above, most of it) 
    -- LinearLayout android:id="@+id/layout1" android:layout_alignParentBottom="true" 
    --- RegisterButton 

有LinearLayout中與註冊按鈕對齊父底部。 使滾動視圖對齊父頂部和底部佈局上方。

+0

無法將父級底部對齊到單個按鈕,因此應用於父級線性佈局的按鈕,然後我無法對齊父級頂部我的滾動視圖,結果可擴展列表視圖無法滾動。感謝您的幫助並給予您時間。 – Harshit

+0

我更新了一些更明確的佈局選項。再次,將原始佈局中的所有內容都保存在滾動視圖的線性佈局中,_except_用於該按鈕,該按鈕位於滾動視圖外的新佈局中。 – user1676075

+0

哦,並更新了更多的格式 - 我認爲我的原始格式已經丟失,所以我添加了額外的破折號來顯示父母,可能是問題所在。 – user1676075

相關問題