Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:LinearLayout不显示在ScrollView下方_Android_Xml_Scrollview_Android Linearlayout - Fatal编程技术网

Android:LinearLayout不显示在ScrollView下方

Android:LinearLayout不显示在ScrollView下方,android,xml,scrollview,android-linearlayout,Android,Xml,Scrollview,Android Linearlayout,在我正在组装的应用程序中,试图让一些按钮出现在srcollview下面时出现了一些问题 带按钮的底部线条布局根本不会出现在屏幕上,这无疑是显而易见的,但我现在很困惑。我想,通过使用RelativeLayout作为主页的父级,然后使用android:layout_below属性,我可以相当轻松地定位它们 <?xml version="1.0" encoding="utf-8"?> <!-- ViewFlipper --> <ViewFlipper

在我正在组装的应用程序中,试图让一些按钮出现在srcollview下面时出现了一些问题

带按钮的底部线条布局根本不会出现在屏幕上,这无疑是显而易见的,但我现在很困惑。我想,通过使用RelativeLayout作为主页的父级,然后使用android:layout_below属性,我可以相当轻松地定位它们

<?xml version="1.0" encoding="utf-8"?>
 <!-- ViewFlipper -->
        <ViewFlipper
            xmlns:android="http://schemas.android.com/apk/res/android"
            android:id="@+id/ViewFlipper01"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            >
<!-- Page 1 (Splash) -->
     <LinearLayout
          android:id="@+id/splashPage"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:orientation="vertical" >
           <TextView
           android:id="@+id/splash"
           android:layout_width="fill_parent"
           android:layout_height="fill_parent" 
           android:text="Display Splash Image"/>
     </LinearLayout>
<!-- Page 2 (Main) -->
    <RelativeLayout
        android:id="@+id/mainPage"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical">
        <LinearLayout
        android:id="@+id/header"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" 
        android:layout_below="@+id/mainPage"
        >
                <TextView
               android:id="@+id/date"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content" 
               android:gravity="center_horizontal" />
        </LinearLayout>
        <ScrollView
        android:id="@+id/scrollView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:layout_below="@+id/header"
        >
              <TableLayout
               android:id="@+id/tableHolder"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content" >
                    <!-- Dynamic TextViews Will Go In Here -->
              </TableLayout>
        </ScrollView>
        <LinearLayout
        android:id="@+id/buttonHolder"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_below="@+id/scrollView" 
        >
          <Button
           android:id="@+id/previous"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="Previous" />
          <Button
           android:id="@+id/next"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:text="Next" />
        </LinearLayout>
    </RelativeLayout>   
 </ViewFlipper> 
 <!-- End of ViewFlipper -->

android:layout\u alignParentBottom=“true”
添加到底部
LinearLayout
。可能是您的滚动视图占用了所有可用空间。

请立即尝试

 <?xml version="1.0" encoding="utf-8"?>
     <!-- ViewFlipper -->
            <ViewFlipper
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/ViewFlipper01"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                >
    <!-- Page 1 (Splash) -->
         <LinearLayout
              android:id="@+id/splashPage"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="vertical" >
               <TextView
               android:id="@+id/splash"
               android:layout_width="fill_parent"
               android:layout_height="fill_parent" 
               android:text="Display Splash Image"/>
         </LinearLayout>
    <!-- Page 2 (Main) -->
        <RelativeLayout
            android:id="@+id/mainPage"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical">
            <LinearLayout
            android:id="@+id/header"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" 
            android:layout_below="@+id/mainPage"
            >
                    <TextView
                   android:id="@+id/date"
                   android:layout_width="fill_parent"
                   android:layout_height="wrap_content" 
                   android:gravity="center_horizontal" />
            </LinearLayout>
            <ScrollView
            android:id="@+id/scrollView"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" 
    android:layout_above="@+id/buttonHolder"
            android:layout_below="@+id/header"
            >
                  <TableLayout
                   android:id="@+id/tableHolder"
                   android:layout_width="fill_parent"
                   android:layout_height="wrap_content" >
                        <!-- Dynamic TextViews Will Go In Here -->
                  </TableLayout>
            </ScrollView>
            <LinearLayout
            android:id="@+id/buttonHolder"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
            android:orientation="horizontal"
            android:layout_below="@+id/scrollView" 
            >
              <Button
               android:id="@+id/previous"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="Previous" />
              <Button
               android:id="@+id/next"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:text="Next" />
            </LinearLayout>
        </RelativeLayout>   
     </ViewFlipper> 
     <!-- End of ViewFlipper -->


添加这两行会导致崩溃?请发布崩溃消息好吗?然后尝试清理项目并重新运行它,这样会使它们出现,但在scrollview内容的顶部会有浮动。嗯……我想我应该尝试暂时删除
scrollview
,只保留
TableLayout
——并将
scrollview
的布局参数复制到
TableLayout
。这将消除滚动控件可能带来的任何异常。一旦你开始工作,你就可以把scrollview放回去了。如果它不起作用,那么你就会知道它是scrollview特有的。哦,还有一件事,虽然不会引起你的问题,但是你的第一个id为
header
线性布局可以被删除。在
TextView
中使用android:layout\u centerHorizontal=“true”。好的,删除滚动视图并将表格视图设置为显示在标题下方,这是我想要的。但是我需要滚动视图,因为当填充内容时,表格视图比屏幕大。太好了!进步。现在的问题是如何使表格滚动。一些链接:和