标签: marquee

文本溢出时的字幕文本

好继承我的问题.假设我有3个div标签,都是100像素宽:

<--- DIV WIDTH --->
Text in div 1
Text in div two, it overflows
Text in div three
<--- DIV WIDTH --->
Run Code Online (Sandbox Code Playgroud)

现在,我目前有这个div的css:

width:100px;
overflow:hidden;
Run Code Online (Sandbox Code Playgroud)

我想要做的是如果文本溢出,它会像一个选框一样滚动,所以如果你等一下,所有的文字都可以看到.但我只希望字幕显示文本是否溢出.

我该怎么办?

谢谢,托尼

html javascript css jquery marquee

4
推荐指数
2
解决办法
8334
查看次数

使用QT平滑文本动画(Marquee文本效果)

我有一个关于如何在非强大的硬件(Atom N270 + Intel 945GSM)上使字幕文本流畅(使用Qt 4.5.3)的问题.我的方法如下:

  1. 我将文本(36px Arial粗体)绘制到QPixmap(离屏绘制设备)上
  2. 我设置了一个计时器,每30ms将1px内容移到左边.
  3. 当触发onTimer事件时,我选择QPixmap并将此部件打印到窗口画布上.

一般来说,它移动顺畅.但是,我创建的字幕越多,其使用的CPU使用率就越高.当文本可以填充50%的屏幕(1920x1680)时,CPU使用率约为70-80%.文本动画变得有点闪烁.如果我将定时器间隔设置为50ms或更大,它将是平滑的.但文字移动太慢了.

我的方法无效吗?我要用OpenGL吗?任何提示都是受欢迎的,并提前谢谢^^)

performance qt qt4 marquee

4
推荐指数
1
解决办法
5495
查看次数

如何在Swift中使用MarqueeLabel?

我想知道是否有一种方法可以启用文本的水平滚动,即字幕类型文本.我使用过这个库:https://github.com/cbpowell/MarqueeLabel-Swift并将"MarqueeLabel.Swift"文件添加到我的应用程序中.但到目前为止,它并没有显示出我想要的效果.

这是我实现它的方式:

class ViewController: UIViewController 
{
@IBOutlet weak var marqueeLabel: MarqueeLabel! 
override func viewDidLoad() {
    super.viewDidLoad()
        self.marqueeLabel.tag = 101
        self.marqueeLabel.type = .Continuous
        self.marqueeLabel.speed = .Duration(5)
        self.marqueeLabel.animationCurve = .EaseInOut
        self.marqueeLabel.fadeLength = 10.0
        self.marqueeLabel.leadingBuffer = 30.0
        self.marqueeLabel.trailingBuffer = 20.0
        self.marqueeLabel.restartLabel()
 }
}
Run Code Online (Sandbox Code Playgroud)

我根据" MarqueeLabel Swift not working "中的解决方案在界面构建器中设置了自定义类.它仍然无法正常工作.

我得到的只是一个没有选框效果(或水平文字滚动)的标签.

PS:我也是iOS开发的新手.此外,我在实现此库之前尝试使用UIScrollView和UITextView.我不能使用UIWebView,因为我试图在TVOS中实现它.

我的问题是:

  1. 我在哪里错误的代码?

  2. 有没有其他方法可以使用Swift显示选框效果?

提前致谢.

xcode marquee ios swift tvos

4
推荐指数
3
解决办法
1万
查看次数

Textview选框以编程方式

尝试从数组中填充textview.我通过下面的代码设法通过XML获得了预期的效果

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
        android:id="@+id/marque_scrolling_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:ellipsize="marquee"
        android:marqueeRepeatLimit="marquee_forever"
        android:padding="16dp"
        android:scrollHorizontally="true"
        android:singleLine="true"
        android:text="Create a Marquee (Scrolling Text) in Android Using TextView. Android Marquee (Scrolling Text) Tutorial with Example"
        android:textSize="24sp" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

但我需要在数组中使用其中的几个 - 所以我认为以编程方式创建文本视图可能是答案,但是无法将它们添加到字幕中.这是我正在努力的代码.

String[] strings = {"Mark", "James", "Paul"};
        LinearLayout layout = (LinearLayout)findViewById(R.id.linearlayout);


        for(String s : strings)
        {
             TextView newTextView = new TextView(this);
             newTextView.setText(s);
             newTextView.setSingleLine(true);
             newTextView.setEllipsize(TextUtils.TruncateAt.END);       
             newTextView.setHorizontallyScrolling(true);
             newTextView.setLines(1);
             newTextView.setMarqueeRepeatLimit(-1);
             newTextView.setSelected(true);  
             newTextView.setTextSize(24);
             layout.addView(newTextView);
        }
Run Code Online (Sandbox Code Playgroud)

android listview marquee textview android-layout

4
推荐指数
2
解决办法
6585
查看次数

如何使用CSS禁用[marquee]标签?这可能吗?

我继承了一个应用程序,用户可以在其中插入自己的HTML响应。我只能为此应用设置一个全局CSS文件和一个全局JS文件。最近,一些用户唤醒了一个古老的恶魔,称为<marquee><blink>标签。

我无法去除输入或输出中的标签,至少可以使用CSS规则撤消它们吗?

blink {
    text-decoration: none;
}
Run Code Online (Sandbox Code Playgroud)

上面摆脱了闪烁效果,是否有类似的方法可以禁用CSS的字幕效果?

如果情况变得更糟,我可以使用marquee { display:none },但是有时用户会在该标签中添加有用的信息;我那里没有足够的杠杆作用来争辩“如果是字幕,按照定义就不重要了”(在其他地方已经足够近似)。

还是我想通过技术手段解决非技术问题,我应该对(内部)用户进行“不应该被调用的邪恶”教育吗?


事实证明,没有纯CSS的跨浏览器解决方案。我必须更努力地使用JS方式-可能用跨距替换字幕。

html css marquee

3
推荐指数
1
解决办法
3327
查看次数

jQuery Vertical Marquee

我正在寻找一个类似于这个的连续滚动字幕(不是HTML元素!),而是垂直向下滚动.

我已经看过很多滚动div,它们会到达底部,然后必须完全滑出页面,然后才能再次看到开始.我需要这是连续的,所以我的div中的最后一个徽标在它下面有第一个徽标.

是否有可用于此类动画的jQuery插件?

jquery animation scroll marquee

3
推荐指数
1
解决办法
2万
查看次数

TextView Marquee在Android 4.0(ISO)小部件中无效

我修正了以下问题.一个简单的改变.替换android:lines="1"android:singleLine="true".


目前我的应用程序将小部件中的文本显示为Marquee.除了4.0版本之外,它在所有Android OS中都按预期工作.我已经在模拟器中测试了API级别14并且文本没有滚动(Marquee).下面是用于在Marquee效果中显示文本的布局xml.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
    android:id="@+id/tv"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:lines="1"
    android:background="@android:color/background_dark"
    android:ellipsize="marquee"
    android:fadingEdge="horizontal"
    android:marqueeRepeatLimit="marquee_forever"
    android:scrollHorizontally="true"
    android:textColor="@android:color/white"
    android:focusable="true"
    android:focusableInTouchMode="true"
     android:duplicateParentState="true"
     android:textSize="20dp">
    <requestFocus android:focusable="true" android:focusableInTouchMode="true"
        android:duplicateParentState="true" />
</TextView>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

帮我解决这个问题.

提前致谢.

marquee android-widget android-layout android-4.0-ice-cream-sandwich

3
推荐指数
1
解决办法
2647
查看次数

在ListView中使用选取框的Android的TextView在第一次显示时不会设置动画

我有一个带有自定义适配器的ListView.其中的每个项目都包含TextView.

<TextView
    android:id="@+id/chat_name"
    android:layout_height="48dp"
    android:layout_width="match_parent"
    android:textColor="#FFFFFF"
    android:gravity="center_vertical"
    android:ellipsize="marquee"
    android:marqueeRepeatLimit="marquee_forever"
    android:singleLine="true"
    android:focusable="false"
    android:focusableInTouchMode="false"/>
Run Code Online (Sandbox Code Playgroud)

我需要这个TextView不可聚焦,因为我依赖于该onListItemClick()方法.据我所知,onListItemClick()如果你设定,就不会开火focusable="true".

在我设置的适配器中:

TextView chatName = (TextView) v.findViewById(R.id.chat_name);
chatName.setText(chat.getChatName());
chatName.setSelected(true);
Run Code Online (Sandbox Code Playgroud)

它每次都有效,但第一次有效.将项目添加到适配器时,它将显示在列表视图中,但不会对其进行标记.单击项目时,将显示另一个活动.用户返回ListView后,该项突然出现.我希望它一直都会被玷污.

我已经尝试使用覆盖的方法对TextView进行子类化,isFocused()以便始终返回true,但这没有帮助.行为保持不变.我还尝试了各种价值观focusablefocusableInTouchMode属性,但没有成功.

android listview marquee

3
推荐指数
1
解决办法
3936
查看次数

如何制作选框UILabel/UITextField/NSTextField

我需要UILabel在Xcode中制作选框.选框将从右向左滚动.

我和其他人CCScrollingLabel也试过了 JHTickerView.但我找不到简单的代码与marquee没有任何视图/数组/一些愚蠢的库和其他人

如何制作选框UILabel?(UITextFieldNSTextField都OK太).

objective-c marquee nstextfield uitextfield uilabel

3
推荐指数
1
解决办法
5148
查看次数

当文本在Flutter中溢出时,如何使Text小部件像选取框一样工作

我正在寻找一种在文本小部件上实现字幕样式的方法,以便当文本从屏幕溢出时它会自动开始滚动。有没有办法做到这一点。我尝试了所有装饰模式,但似乎无法在此处找到“字幕”选项。

user-interface text marquee dart flutter

3
推荐指数
1
解决办法
1782
查看次数