2011-11-09 159 views
0

我在TableLayout中有一個TableRow。如果我在TableRow中放置一個垂直的ScrollView,它會按預期工作。但是,如果我將一個Horizo​​ntalScrollView放在TableRow中,那麼滾動根本不起作用。TableRow中的Horizo​​ntalScrollView

有誰知道爲什麼會發生這種情況?我可以使用任何解決方法來實現嗎?

在此先感謝!

- 編輯 -

下面是一個例子:

<?xml version="1.0" encoding="utf-8"?> 
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <TableRow> 
     <HorizontalScrollView android:scrollbars="horizontal" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent"> 

      <TableLayout android:layout_width="fill_parent" android:layout_height="fill_parent"> 

       <TableRow> 
        <Button android:layout_width="350px" android:layout_height="350px" android:text="TEST" /> 
        <Button android:layout_width="350px" android:layout_height="350px" android:text="TEST" /> 
       </TableRow> 
       <TableRow> 
        <Button android:layout_width="350px" android:layout_height="350px" android:text="TEST" /> 
        <Button android:layout_width="350px" android:layout_height="350px" android:text="TEST" /> 
       </TableRow> 
      </TableLayout> 

     </HorizontalScrollView> 

    </TableRow> 

</TableLayout> 

如果我改變Horizo​​ntalScrollView到垂直滾動型,它的工作原理(顯然垂直)。

+0

發佈您的佈局xml和相關的Java。 – Krylez

+0

你解決了這個問題嗎? –

回答

0

嘗試

<HorizontalScrollView android:scrollbars="horizontal" 
     android:layout_width="wrap_content" 
     android:layout_height="fill_parent"> 

編輯:

這應了滾動設置爲在parrent可用的地方大小的內容insteat的大小(內容大小)。

+0

歡迎來到StackOverflow。你可能想要給你的答案增加一些解釋(爲什麼這會解決問題等等),或者至少要記住你的未來答案...... – hlt

相關問題