首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Android应用滚动

Android应用滚动
EN

Stack Overflow用户
提问于 2011-03-04 09:23:24
回答 2查看 4.5K关注 0票数 1

我已经创建了一个具有基于XML布局的简单应用程序。在接收到来自ImageView请求的数据之后,用内容onCreate填充http和TextView文本。问题是,在呈现GUI时,手机的滚动无法正常工作。完全没有。有经验的人可以帮我吗?提前感谢!/Jesper

Main.xml:

代码语言:javascript
运行
复制
<?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>
EN

回答 2

Stack Overflow用户

发布于 2011-03-04 09:29:14

如果我理解了您的问题,您是否尝试过将所有xml包含到父<ScrollView>中??

编辑:

类似于:

代码语言:javascript
运行
复制
< 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>
票数 2
EN

Stack Overflow用户

发布于 2017-04-15 23:01:39

把所有东西都放在<scrollview>标签里对我很管用。确保使用android:fillViewport="true"填充视口

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5188657

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档