2014-06-20 59 views
0

我试图让我的滚动视图占用整个屏幕的宽度。我在行上使用了匹配父项,并且在自己的滚动视图上使用它。但它仍然不会扩展到屏幕的整个宽度。我试过其他的东西,如填充:视口,但没有工作。 链接到电流输出http://imgur.com/cKjPvF7 的截图我把粉红色的背景色上滚动视图Android-如何让滚动视图占据整个屏幕的宽度?

了滚动XML代码插入滚动视图上

<TableRow 
     android:id="@+id/tableRow3" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" 
     > 

     <ScrollView 
      android:id="@+id/scroll" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_span="3" 
      android:background="@color/corn" 
      android:fillViewport="true" > 

      <TableLayout 
       android:id="@+id/completeTable" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" > 

      </TableLayout> 
     </ScrollView> 

    </TableRow> 

代码行的表格行IM (不要认为这是你应该考虑使用LinearLayout/RelativeLayout/FrameLayout您APPLI问题

<TableRow xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/tableRow1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    > 

     <TextView 
      android:id="@+id/task" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      /> 

     <Button 
      android:id="@+id/delete" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 

      android:text="@string/deleteItem" /> 

</TableRow> 
+1

为什么在滚动视图之外有一个表格行? – raybaybay

+0

我使用整个应用程序的表格布局(一致性)。表格行不应该是一个问题吗? – committedandroider

+0

哇,这是问题。谢啦。你知道为什么滚动视图不占用整个表格行吗? – committedandroider

回答

1

阳离子屏幕!

我认为你的问题在这里是因为你的主TableLayout有很多桌子,它们大大超过了你的ScrollView。你的TableRow设置为wrap_content,这可能会压坏你的ScrollView

相关问题