TextView 选框不起作用

编程入门 行业动态 更新时间:2024-10-28 16:29:37
本文介绍了TextView 选框不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我已经尝试了所有方法,我可以想到让这种选取框效果起作用.这是我的 xml:

I've tried all, I can think of to get this marquee effect to work. Here is my xml:

<TextView android:id="@+id/curPlaying"
    android:layout_width="320dp"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:ellipsize="marquee"
    android:scrollHorizontally="true"
    android:singleLine="true"
    android:marqueeRepeatLimit ="marquee_forever"
    android:focusable="true"
    android:focusableInTouchMode="true" 
    android:textColor="#83A602"
    android:textSize="20dp"
    android:text="Nothing Loaded" />

我将其设置为在代码中选择.我认为它可能不起作用的唯一原因是文本以相对频繁的间隔被代码修改.

And I'm setting it as selected in code. The only thing why I think it might not be working is the text is getting modified by the code at relatively frequent intervals.

帮助?

推荐答案

请尝试下面的代码,它对我来说工作正常...

Hi Please try below code it is working fine for me...

<TextView
            android:id="@+id/mywidget"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:ellipsize="marquee"
            android:fadingEdge="horizontal"
            android:lines="1"
            android:marqueeRepeatLimit="marquee_forever"
            android:scrollHorizontally="true"
            android:text="Simple application that shows how to use marquee, with a long text"
            android:textColor="#ff4500" />

<小时>

TextView tv = (TextView) this.findViewById(R.id.mywidget);
        tv.setSelected(true); // Set focus to the textview

它适用于我的三星 Galaxy ACE 手机.

It is working on My Samsung Galaxy ACE Phone.

这篇关于TextView 选框不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 19:16:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1398022.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   TextView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!