【发布时间】:2018-03-01 16:37:07
【问题描述】:
在这里发疯了,(为了清楚起见:我在 stackoverflow 上查看了有关“滚动视图不起作用”的所有问题,但没有一个有帮助)。以下是我正在尝试做的简短版本
<ScrollView
android:id="@+id/week_View"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Monday" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Monday" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Monday" />.....
.............
</LinearLayout>
</ScrollView>
如果没有清除,Textview 会在 linearLayout 内重复多次,我希望它水平滚动。我得到的是:
您会看到最后的 textView 被“挤压”,其余的 textview 甚至没有显示,并且滚动视图不会向左或向右移动。我做错了什么? (滚动视图被包裹在一个RelativeLayout中)。
【问题讨论】:
-
你想要什么?你的意思是你的
LinearLayout的orientation是vertical吗?或者你可能想要一个HorizontalScrollView来代替? -
@MikeM。我希望能够水平滚动 - 抱歉那里不清楚
-
ScrollView垂直滚动。你想要一个HorizontalScrollView。
标签: android xml scrollview