2011-03-04 68 views
1

我已經使用基於XML的佈局創建了一個簡單的應用程序。在接收到來自http請求的數據後,ImageView src和TextView文本被填充onCreate內容。問題在於,當GUI呈現時,手機的滾動不起作用。完全一樣。有更多經驗的人可以幫助我嗎? 在此先感謝! /加斯帕Android應用程序滾動

的main.xml:

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

<ImageView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/image1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    /> 
    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:stretchColumns="1" 
    android:paddingBottom="20px" 
    > 
    <TableRow> 
     <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Players" 
      /> 
      <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/players1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="right" 
      android:text="0" 
      /> 
    </TableRow> 

    <TableRow> 
     <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Bad Beat Jackpot" 
      /> 
      <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/bbj1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="right" 
      android:text="0" 
      /> 
    </TableRow> 

    <TableRow> 
     <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Hand #" 
      /> 
      <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/hand1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="right" 
      android:text="0" 
      /> 
    </TableRow> 
</TableLayout> 

<ImageView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/image2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    /> 
    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:stretchColumns="1" 
    android:paddingBottom="20px" 
    > 
    <TableRow> 
     <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Players" 
      /> 
      <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/players2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="right" 
      android:text="0" 
      /> 
    </TableRow> 

    <TableRow> 
     <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Bad Beat Jackpot" 
      /> 
      <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/bbj2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="right" 
      android:text="0" 
      /> 
    </TableRow> 

    <TableRow> 
     <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Hand #" 
      /> 
      <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/hand2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="right" 
      android:text="2" 
      /> 
    </TableRow> 
</TableLayout> 

<ImageView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/image3" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    /> 
    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:stretchColumns="1" 
    android:paddingBottom="20px" 
    > 
    <TableRow> 
     <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Players" 
      /> 
      <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/players3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="right" 
      android:text="0" 
      /> 
    </TableRow> 

    <TableRow> 
     <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Bad Beat Jackpot" 
      /> 
      <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/bbj3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="right" 
      android:text="3" 
      /> 
    </TableRow> 

    <TableRow> 
     <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Hand #" 
      /> 
      <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/hand3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="right" 
      android:text="4" 
      /> 
    </TableRow> 
</TableLayout> 

<ImageView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/image4" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    /> 
    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:stretchColumns="1" 
    android:paddingBottom="20px" 
    > 
    <TableRow> 
     <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Players" 
      /> 
      <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/players4" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="right" 
      android:text="0" 
      /> 
    </TableRow> 

    <TableRow> 
     <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Bad Beat Jackpot" 
      /> 
      <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/bbj4" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="right" 
      android:text="0" 
      /> 
    </TableRow> 

    <TableRow> 
     <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Hand #" 
      /> 
      <TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/hand4" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:gravity="right" 
      android:text="0" 
      /> 
    </TableRow> 
</TableLayout> 
</LinearLayout> 

回答

2

如果我有明白你的問題,你有沒有嘗試過包括所有的XML到父<ScrollView>

編輯:

類似:

< ScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
      android:background="@drawable/back" 
    > 
    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     > 
    //more xml tags.... 

    </RelativeLayout> 
    </ScrollView> 
+0

不,我沒有。你能解釋一下在scroll view標籤裏面放些什麼嗎? 謝謝 – 2011-03-04 01:35:24

+0

任何運氣與我的編輯? – 2011-03-04 01:58:39

+0

非常感謝你! :)/J – Jesper 2011-03-04 09:27:44

0

把一切都在<scrollview>標籤爲我工作。 確保使用它填充視口 android:fillViewport="true"