Android 如何使用父布局滚动可展开列表视图
滚动完整布局的可扩展列表视图时出现问题 我正在尝试创建一个注册页面,其中包含用户名和密码等文本字段,以及可扩展的列表视图,如图所示 页面加载时,可以在底部看到“注册新”按钮,但如果我按下可展开列表视图,则在折叠列表视图之前无法向下滚动到底部 以下是随附的我的布局文件Android 如何使用父布局滚动可展开列表视图,android,android-layout,android-listview,Android,Android Layout,Android Listview,滚动完整布局的可扩展列表视图时出现问题 我正在尝试创建一个注册页面,其中包含用户名和密码等文本字段,以及可扩展的列表视图,如图所示 页面加载时,可以在底部看到“注册新”按钮,但如果我按下可展开列表视图,则在折叠列表视图之前无法向下滚动到底部 以下是随附的我的布局文件 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.co
<?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
使用register(注册)按钮使LinearLayout(线性布局)与底部对齐。
让滚动视图将上级顶部与下级布局上方对齐。无法将上级底部与单个按钮对齐,因此应用于按钮的上级线性布局,然后我无法将上级顶部与我的滚动视图对齐,导致可扩展列表视图无法滚动。谢谢你的帮助和时间。我更新了一些更明确的布局选项。同样,在滚动视图的线性布局中保留原始布局中的所有内容,除了按钮,它位于滚动视图之外的新布局中。哦,并且更新了一些格式-我认为我的原始格式丢失了,所以我添加了额外的前导破折号来显示父项,这可能是问题所在。