Android 这听起来可能是一个微不足道的问题,但我是谁让我的布局可以滚动的呢

Android 这听起来可能是一个微不足道的问题,但我是谁让我的布局可以滚动的呢,android,Android,可滚动的意思是通过用户触摸,他可以在给定的布局中上下移动 这就是我所做的,模拟器抛出了一个异常空指针,我很难弄清楚它是从哪里来的 <?xml version="1.0" encoding="UTF-8"?> <ScrollView> <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:lay

可滚动的意思是通过用户触摸,他可以在给定的布局中上下移动

这就是我所做的,模拟器抛出了一个异常空指针,我很难弄清楚它是从哪里来的

<?xml version="1.0" encoding="UTF-8"?>
<ScrollView>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">


<LinearLayout

 android:layout_width="wrap_content" 
 android:layout_height="wrap_content">
 <TextView 
 android:text="Country City Game(aka CCG) is an acdemic work of MTA students enjoy the game"
  android:textSize="24.5sp"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"></TextView>
 </LinearLayout>




</TableLayout>
</ScrollView>

这个不起作用,但当我掉下去的时候

   <ScrollView> </ScrollView> 


有人能告诉我怎么了吗

环绕您想要有一个带有滚动条的布局,将您想要的整个布局放在一个滚动条内。

试试这个

<?xml version="1.0" encoding="UTF-8"?>

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent" android:layout_height="fill_parent">

<TableLayout 
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:stretchColumns="1">

<TableRow>

  <TextView 
   android:text="Country City Game(aka CCG) is an acdemic work of MTA students enjoy the game"
   android:textSize="24.5sp"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"></TextView>

</TableRow>

</TableLayout>

</ScrollView>


很抱歉重复发布。我现在知道了,陈尼森的反应快了一点。请注意变化,我想我已经尝试过你说的,但我认为我的方向不对。我理解这个概念可能有问题吗?我应该对每个视图项做什么?谢谢,但它仍然有一个运行时错误。。。你能看到上面的代码(我刚刚加上他)并告诉我出了什么问题吗?…你已经编辑了这个问题以包含建议的答案-这现在令人困惑。您应该在编辑中提到您已经这样做了,否则以后查看此问题的任何其他人可能都不理解问题和相关解决方案是什么。StackOverflow不仅仅是为了回答你的问题,它是为了建立一个问答库来帮助开发人员。同样的问题,我只是添加了更多的文本和示例,以帮助其他人看到所有的图片,我可能在另一个地方错了。。。