问题描述
我工作的一个计算器。我注意到,在默认的Android钙可以水平滚动的TextView。我抬起头的文件,发现有关属性安卓scrollHorizontally
,但将它添加到TextView的我还做不到水平滚动之后,有关于它的任何进一步的信息文档导致我认为,只有加入ATTR应该足够了。这是计算器的TextView的:
< TextView的机器人:ID =@ + ID / edit_text
机器人:layout_width =0dip
机器人:layout_height =match_parent
机器人:layout_weight =8
机器人:单线=真
机器人:scrollHorizontally =真
机器人:重力=中心|右
机器人:文本=0/>
当字符超出TextView的宽度的字符串修整和......出现在它的结束。我究竟做错了什么?
< HorizontalScrollView机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT>
< TextView的Android的:layout_width =40dp
机器人:layout_height =WRAP_CONTENT
机器人:scrollHorizontally =真
机器人:文本=横向滚动视图将现在的工作/>
< / HorizontalScrollView>
这是滚动的TextView使水平滚动的方式。
I'm working on a calculator. I noticed that in the default android calc you can scroll the textview horizontally. I looked up the documentation and found out about the attribute android:scrollHorizontally
but after adding it to the textview I still cannot do horizontal scroll, there is no further info about it on the documentation leading me to think that only adding the attr should suffice. This is the calculator's textview:
<TextView android:id="@+id/edit_text"
android:layout_width="0dip"
android:layout_height="match_parent"
android:layout_weight=".8"
android:singleLine="true"
android:scrollHorizontally="true"
android:gravity="center|right"
android:text="0" />
When characters exceed the textview width the string is trimmed and ... appear at it's end. What am I doing wrong?
<HorizontalScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:layout_width="40dp"
android:layout_height="wrap_content"
android:scrollHorizontally="true"
android:text="Horizontal scroll view will work now"/>
</HorizontalScrollView>
that is the way to scroll textview make scroll horizontally.
这篇关于在TextView的Android上水平滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!