[英]How to scroll expandable list view with parent layout
滾動具有完整布局的可擴展列表視圖時出現問題。
我正在嘗試創建一個注冊頁面,其中包含諸如用戶名和密碼之類的文本字段,以及如圖所示的可擴展列表視圖。
頁面加載的瞬間可以在底部看到注冊新按鈕,但是如果我在可擴展列表視圖上按下,在折疊列表視圖之前我無法向下滾動至底部。
以下是與此相關的我的布局文件。
<?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>
我想知道,布局文件可能有什么問題? 提前致謝。
將它們放在兩種不同的布局中。 也就是說,我建議您:
- 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的注冊按鈕與父控件底部對齊。 使滾動視圖將父視圖頂部和下部布局上方對齊。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.