android - XML 布局 - 滚动后按钮不可见

标签 android xml android-layout android-linearlayout android-xml

我有一个 XML 布局如下。我有一个 TextView ,后面跟着一些复选框,然后是一个按钮。我已将所有复选框包含在一个线性布局中,并为此设置了一个 ScrollView 。`向下滚动后我无法查看我的按钮,我该怎么办?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >


    <TextView />

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

        <LinearLayout>

            <CheckBox />

            <CheckBox />

            <CheckBox/>

            <CheckBox/>

            <CheckBox/>

            <CheckBox/>

            <CheckBox/>

            <CheckBox/>

            <CheckBox />

            <CheckBox/>

            <CheckBox />
        </LinearLayout>
    </ScrollView>

    <Button

    </Button>

</LinearLayout>

最佳答案

ScrollView 有条件 ScrollView 应该只有一个 subview subview 可能包含 subview

如果你想显示你有使用 View 怀特概念的按钮

    <LinearLayout
        <TextView
    <ScrollView   
    <LinearLayout
      <CheckBox
        <CheckBox
        <CheckBox
        <CheckBox
        .



        <CheckBox
    LinearLayout>
    ScrollView>
        <Button
 android:layout_weight="1"

    LinearLayout >

关于android - XML 布局 - 滚动后按钮不可见,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12759474/

相关文章:

android - 覆盖 Activity 布局的 fragment

android - 在单击任何布局之前,不会触发动画方法 applyTransformation

Android - 在 RecyclerView 中重新创建自定义动态生成的复合 View ,导致性能不佳

java - 为什么 imageView 没有居中?

c# - 选择子节点,但使用 XPath 忽略非元素?

java - 如何获取代表具有特定 [property,object] 对的对象的 RDF 资源?

javascript - AJAX:帮助让 xml 显示在 html 中

Android广播接收器蓝牙事件捕获

android - 在 Touch Android 上具有拖动、滚动和缩放功能的三角形 ImageView

android - ScrollView 内的 View 并没有占据所有位置