【发布时间】:2013-08-08 10:02:00
【问题描述】:
我一直在查看其他主题,但找不到答案,所以我的问题来了:
是否可以使用 layout_weight 创建一个自动水平滚动的 TextView,其右侧有一个按钮?
“我在这里的搜索文本非常长”“按钮”
我尝试使用“fill_parent”而不是 0dp 和 layout_weight 来制作一个可滚动的文本视图,但随后整个文本占据了“行”(显然因为它是 fill_parent)并且没有显示按钮并且文本没有'即使当我在 android 虚拟设备中运行它时,也不会水平滚动。
编辑:忘了写我是如何制作可滚动文本视图的
<TextView
android:singleLine="true"
android:scrollHorizontally="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/searchResult"
android:focusable="true"
android:focusableInTouchMode="true"/>
【问题讨论】:
-
这个问题已经在这里问过了。看看this
-
试过了,没用,没有滚动,我不确定你是否阅读了整个问题。问题是是否有可能使用 layout_weight 在其右侧有另一个对象,例如按钮。
标签: android textview horizontal-scrolling