草庐IT

android - 选取框不在 android 中滚动

coder 2023-12-18 原文

我想在我的 android 应用程序中使用选取框的功能,并使用此代码来实现目标:

 <TextView
    android:id="@+id/marqueetext"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:lines="1"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"
    android:text="hello all how are you"
    android:textColor="#ff4500" 
    />

MarqueeText = (TextView)ShowTheMessages.this.findViewById(R.id.marqueetext);
        MarqueeText.setSelected(true);

我不知道为什么它不起作用。我浏览了很多相关帖子但没有找到解决方案。请帮助我。在此先感谢。

最佳答案

更改此行并尝试...

android:text="hello all how are you hello all how are you hello all how are you hello all how are you"
TextView txtView=(TextView) findViewById(R.id.marqueetext);
txtView.setSelected(true);

 <TextView
    android:id="@+id/marqueetext"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:lines="1"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"
    android:text="hello all how are you hello all how are you hello all how are you hello all how are you"
    android:textColor="#ff4500" 
    />

或者另一个例子是...

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView
        android:id="@+id/marqueetext"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:lines="1"
        android:ellipsize="marquee"
        android:fadingEdge="horizontal"
        android:marqueeRepeatLimit="marquee_forever"
        android:scrollHorizontally="true"
        android:textColor="#ff4500"
        android:text="hello all how are you hello all how are you hello all how are you hello all how are you hello all how are you" />
</RelativeLayout>

关于android - 选取框不在 android 中滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13486935/

有关android - 选取框不在 android 中滚动的更多相关文章

  1. ruby-on-rails - form_for 中不在模型中的自定义字段 - 2

    我想向我的Controller传递一个参数,它是一个简单的复选框,但我不知道如何在模型的form_for中引入它,这是我的观点:{:id=>'go_finance'}do|f|%>Transferirde:para:Entrada:"input",:placeholder=>"Quantofoiganho?"%>Saída:"output",:placeholder=>"Quantofoigasto?"%>Nota:我想做一个额外的复选框,但我该怎么做,模型中没有一个对象,而是一个要检查的对象,以便在Controller中创建一个ifelse,如果没有检查,请帮助我,非常感谢,谢谢

  2. ruby - 当使用::指定模块时,为什么 Ruby 不在更高范围内查找类? - 2

    我刚刚被困在这个问题上一段时间了。以这个基地为例:moduleTopclassTestendmoduleFooendend稍后,我可以通过这样做在Foo中定义扩展Test的类:moduleTopmoduleFooclassSomeTest但是,如果我尝试通过使用::指定模块来最小化缩进:moduleTop::FooclassFailure这失败了:NameError:uninitializedconstantTop::Foo::Test这是一个错误,还是仅仅是Ruby解析变量名的方式的逻辑结果? 最佳答案 Isthisabug,or

  3. 安卓apk修改(Android反编译apk) - 2

    最近因为项目需要,需要将Android手机系统自带的某个系统软件反编译并更改里面某个资源,并重新打包,签名生成新的自定义的apk,下面我来介绍一下我的实现过程。APK修改,分为以下几步:反编译解包,修改,重打包,修改签名等步骤。安卓apk修改准备工作1.系统配置好JavaJDK环境变量2.需要root权限的手机(针对系统自带apk,其他软件免root)3.Auto-Sign签名工具4.apktool工具安卓apk修改开始反编译本文拿Android系统里面的Settings.apk做demo,具体如何将apk获取出来在此就不过多介绍了,直接进入主题:按键win+R输入cmd,打开命令窗口,并将路

  4. ruby-on-rails - 语言环境不在 Rails 4 中切换 - 2

    我的Rails应用程序在rails4.0.2上,我在使用locale变量和params[:locale]切换翻译时遇到问题官方railsguide.我在mysite有一个单页网站.我的国际化路线:scope"(:locale)",locale:/en|de/do#myrouteshereend我的应用程序Controllerbefore_filter:set_localedefset_localeI18n.locale=params[:locale]||I18n.default_locale#Rails.application.routes.default_url_options[:l

  5. ruby-on-rails - Phusion Passenger 不在 Apache 上工作 - 2

    更新:当输入“passenger-memory-stats”时,我显示:---Passengerprocesses---Processes:0我该如何解决这个问题?为什么即使我在httpd.conf中添加它并重新启动apache,passenger也不会启动?我无法让PhusionPassenger在服务器上运行RubyonRails。我已经按照Phusion网站上的所有说明安装了passenger并修改并创建了ApacheVirtualHost以指向新目录并验证所有.conf文件都已成功加载。还加载了httpd-Mpassenger_module。我还在本地主机上成功运行了Passe

  6. ruby-on-rails - `allow_any_instance_of` 模拟不在范围内工作 - 2

    我的mock只有在如下所示的beforeblock中时才有效。这只是我对我的问题的快速而肮脏的表述。从字面上看,当我将行从beforeblock移动到doesnotquack断言时,它停止模拟:(describe'Ducks',type::featuredobeforedo...allow_any_instance_of(Duck).toreceive(:quack).and_return('bark!')visitanimal_farm_pathendcontext'isanoddduck'it'doesnotquack'doexpect(Duck.new.quack).toeq('

  7. ruby - 如何不在 ruby​​ 中编写完整的模块路径? - 2

    假设我在一个非常长的模块路径中有一个类:sux=Really::Long::Module::Path::Sucks.new我能否以某种方式“导入”这个模块,这样我就可以直接使用这个类,而不必担心每次使用它时都要写这个路径?编辑:我知道在同一个模块中会让事情变得更容易。但在这种情况下,我不能在同一个模块中。 最佳答案 模块是ruby​​中的对象,因此您可以只引用较短的模块。Sux=Really::Long::Module::Path::SucksSux.new 关于ruby-如何不在rub

  8. ruby - Gem 在 irb 中加载但不在控制台中加载 - 2

    这个让我抓狂。我可以通过irb加载gem:steve@server:/var/www/listings$irbirb(main):001:0>Gem.path=>["/home/steve/.gem/ruby/1.9.1","/usr/local/ruby/lib/ruby/gems/1.9.1"]irb(main):002:0>require'nokogiri'=>true但我无法通过Rails控制台加载它:irb(main):001:0>Gem.path=>["/home/steve/.gem/ruby/1.9.1","/usr/local/ruby/lib/ruby/gems/1

  9. ruby - 绕过 Element 的方法无法滚动到 View 中 - Watir-webdriver with Ruby - 2

    因此,我们的页面中有以下代码:OnOff这是2个单选按钮。'开和关'。“关闭”是默认值。使用Watir-webdriver和Ruby,我们想要选择“打开”单选按钮。我们这样做:browser.radio(:id=>"HasRegistration_true").set但在这样做时,我们得到以下错误:`WebElement.clickElement':Elementcannotbescrolledintoview:[objectHTMLInputElement](Selenium::WebDriver::Error::MoveTargetOutOfBoundsError)我们知道Sele

  10. ruby - 创建一个临时文件而不在 Ruby 中打开它 - 2

    有没有办法在不打开临时文件的情况下创建它?我必须运行一个可执行文件,将它的输出重定向到一个文件,然后读取并解析它。tempfile创建的所有内容都已打开,这会触发错误,因为文件已锁定。 最佳答案 你也可以使用Dir::TmpnameDir::Tmpname.create('your_application_prefix'){|path|putspath}路径将包含唯一路径参见https://github.com/ruby/ruby/blob/ruby_1_9_3/lib/tmpdir.rb#L116

随机推荐