我正在使用ScrollView,但它不起作用。它没有回应。我想知道是否有人可以在我的XML文件中找到可疑的东西。ScrollView未响应LinearLayout
我确实有其他的xml文件使用相同的Android工具,他们工作得很好。
这里是我的代码:
<?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">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="alias"
android:id="@+id/alias"
android:layout_marginTop="15dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="date_of_post"
android:id="@+id/date_of_post" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="comment"
android:id="@+id/comment"
android:layout_marginBottom="15dp" />
</LinearLayout>
</ScrollView>
如果你想要它滚动的LinearLayout需要wrap_parent。如果它填满屏幕,它将开始滚动 – Xjasz
我没有看到代码的任何问题,它应该正常工作。您是否在其他地方将此视图充气或将您用作活动的内容视图? –
DDMS视图层次转储对于这样的布局问题是无价的。我建议在调试器中转储视图层次结构。 –