不断水平滚动EditText

时间:2013-07-30 10:36:53

标签: android

对于我正在创建的应用,由于空间有限,我有一些无法变大的字段。出于这个原因,我希望这些字段能够连续滚动。这有点像汽车收音机中有时发现的那样,例如RDS信息滚动。这可能使用Android吗?我已经使用ScrollerMovementMethod

尝试了它
myEditText.setScroller(new Scroller(this)); 
myEditText.setMaxLines(1); 
myEditText.setHorizontalScrollBarEnabled(true);
myEditText.setMovementMethod(new ScrollingMovementMethod()); 

然而,这并不是我想做的事情。这是我的EditText:

<EditText
 android:id="@+id/pedigreeLineAEditText"
 android:layout_width="match_parent"
 android:layout_height="@dimen/line_height"
 android:clickable="false"
 android:cursorVisible="false"
 android:focusable="false"
 android:focusableInTouchMode="false"
 android:inputType="none"
 android:singleLine="true"
 android:textSize="@dimen/text_size" />

1 个答案:

答案 0 :(得分:0)

是否需要成为EditText?如果没有,你可以试试这样的东西

  <TextView
android:text="START | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | lunch 20.00 | Dinner 60.00 | Travel 60.00 | Doctor 5000.00 | END"
android:id="@+id/MarqueeText" 
android:layout_width="fill_parent"
android:layout_height="wrap_content" 
android:singleLine="true"
android:ellipsize="marquee" 
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true" 
android:paddingLeft="15dip" 
android:paddingRight="15dip" 
android:focusable="true" 
android:focusableInTouchMode="true" 
android:freezesText="true">

我认为这不会以同样的方式使用编辑文本,但这可能适合您。本规范来自另一个可以在这里看到的答案

TextView Marquee not working

相关问题