我已经创建了一个具有基于XML布局的简单应用程序。在接收到来自ImageView请求的数据之后,用内容onCreate填充http和TextView文本。问题是,在呈现GUI时,手机的滚动无法正常工作。完全没有。有经验的人可以帮我吗?提前感谢!/Jesper
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>发布于 2011-03-04 09:29:14
如果我理解了您的问题,您是否尝试过将所有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>发布于 2017-04-15 23:01:39
把所有东西都放在<scrollview>标签里对我很管用。确保使用android:fillViewport="true"填充视口
https://stackoverflow.com/questions/5188657
复制相似问题