是否有可能在jQuery(或只是javascript但jQuery首选)中创建100%无缝选框?
我做了一个简单的选框,向左移动直到它离开屏幕然后只是跳到(在视线外)向右,然后重新开始.但是我希望它没有等待.
我能想到这样做的唯一方法是复制文本并将其放在第一个文本之后,然后再将它们交换掉.但是我不知道如何在jQuery中实现它,我一直在研究jQuery,.clone()但无法使它正常运行,一切都在跳跃.
有任何想法吗?
谢谢你的时间,
可以使用<marquee>HTML元素了吗?我的意思是,是否所有浏览器都支持它?我知道Twitter正在使用它,我认为这对于公告非常有用,我想使用它,但我不知道它是否能正常使用.有人知道吗?
这在其他地方被问过,但解决方案对我不起作用.所以用更多的背景再次构成它.问题是活动包含滚动的音乐标题文本视图,该视图被更新的经过时间计数器文本视图中断.
我在我的活动布局中有这两个TextView小部件(尽管它们被其他布局容器包含).
<TextView android:id="@+id/v_current_time"
android:minWidth="26dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="right|center_vertical"
android:singleLine="true"
android:textSize="12sp"
android:enabled="false"
/>
<TextView android:id="@+id/v_track_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:textStyle="normal"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:focusable="true"
android:focusableInTouchMode="true"
android:enabled="true"
/>
Run Code Online (Sandbox Code Playgroud)
音乐标题被动态设置为(在测试用例中)一长行文本.如果我从未使用以下行更新当前时间的文本,则无论我如何与暂停和播放按钮进行交互,音乐标题都将很乐意滚动.
tvCurrentTime.setText(DataFormat.formatTime(progress));
Run Code Online (Sandbox Code Playgroud)
但如果我确定当前时间的文本,音乐标题将停止.按下我的暂停按钮以某种方式将滚动回到齿轮,但按下播放将导致当前时间更新并再次停止.
根据这个帖子中的建议,我试图将时间文本的设置与重新启用滚动标题结合起来,如下所示:
tvCurrentTime.setText(DataFormat.formatTime(progress));
tvTitle.setEnabled(true);
Run Code Online (Sandbox Code Playgroud)
除了每次重新启动时重置滚动条以外,这对失败没有影响.
是否有一些我遗漏的细节,或者有什么可能出错的其他想法?非常感谢!
我正在寻找marquee标签替代品,并发现如何通过CSS进行.但是我使用的消息长度可变,所以可以选择将'45s'属性设置为100%,这样无论消息有多长或多短,消息都会显示所有消息和循环消息显示后再次显示?
.marquee {
margin: 0 auto;
white-space: nowrap;
overflow: hidden;
position: absolute;
color: #ffffff;
background-color: #000000;
font-family: Arial Rounded MT Bold;
}
.marquee span {
display: inline-block;
padding-left: 100%; /* show the marquee just outside the paragraph */
animation: marquee 45s linear infinite;
}
@keyframes marquee {
from { text-indent: 0%}
to { text-indent: -150% }
}Run Code Online (Sandbox Code Playgroud)
<p id="PassengerNews_Scrollbar" class="microsoft marquee" style="height: 95%; width: 90%;left: 5%;top: 2%;font-size: 7%;">
<span>|*NewsData*|</span>
</p>Run Code Online (Sandbox Code Playgroud)
我想要实现的是当我点击按钮时,选取框会播放一次.我的问题是,如果我将循环设置为1,那么它只播放一次然后什么都不做.我的另一个问题是,如果我放开鼠标左键,它会在当前代码中途停止.或者它停在原处.是否有任何方法可以在按下按钮时播放一次,然后在再次按下按钮时再次播放并允许它完全完成循环.这是代码,我愿意使用java脚本而不是html.这是我目前的代码:
<marquee behavior="scroll" direction="up" scrollamount="30" id="marquee" height="40">
<p>+1</p>
</marquee>
<input type="button" id="gather" class="build" Value="play" onmousedown="document.getElementById('marquee').start()." onmouseup="document.getElementById('marquee').stop()" onload="document.getElementById('marquee').stop()">Run Code Online (Sandbox Code Playgroud)
尝试使用流畅的文本动画构建选取框控件.目前的努力包括:
但动画仍然不稳定且资源密集(2-10%CPU).
在我假设的默认wpf窗口中使用的测试代码应该产生一个平滑的动画:
<TextBlock x:Name="_box" FontSize="64" CacheMode="BitmapCache" Text="lorem ipsum">
<TextBlock.RenderTransform>
<TranslateTransform x:Name="AnimatedTranslateTransform" X="0" Y="0" />
</TextBlock.RenderTransform>
<TextBlock.Triggers>
<EventTrigger RoutedEvent="TextBlock.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="AnimatedTranslateTransform"
Storyboard.TargetProperty="X"
From="-300" To="300" Duration="0:0:5"
AutoReverse="True" RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</TextBlock.Triggers>
</TextBlock>
Run Code Online (Sandbox Code Playgroud)
清单:
测试:
任何想法(或更好的代码示例)?
从响应来看,这似乎不是一个wpf问题(其他选框控件对其他人来说工作正常,但不适合我),坚果我在我测试过的每台机器上都遇到了同样的问题.
注意:好的,我承认标题有点模糊,但英语不是我的主要语言,我不知道如何在一个标准中描述问题.
我正在尝试创建一个在gridView上显示所有应用信息的应用.
gridView将其numColumns设置为auto_fit,以便为所有类型的屏幕很好地设置其列数.
由于每个应用程序的信息有时可能很长,因此单元格高度可能与其旁边的单元格高度不同.
我希望网格单元具有相同的宽度(在所有情况下都可以正常工作),并且对于每一行,高度应由行的单元格的最大高度确定.
这会导致奇怪的事情发生:
以下是显示#2和#3问题的屏幕截图(它们通常不会一起显示):

这是网格单元格的xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/list_divider_holo_dark" >
<ImageView
android:id="@+id/appIconImageView"
android:layout_width="48dip"
android:layout_height="48dip"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:adjustViewBounds="true"
android:contentDescription="@string/app_icon"
android:src="@drawable/ic_menu_help" />
<TextView
android:id="@+id/appLabelTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/isSystemAppImageView"
android:layout_toRightOf="@+id/appIconImageView"
android:ellipsize="marquee"
android:text="label"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/appDescriptionTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/appLabelTextView"
android:layout_below="@+id/appLabelTextView"
android:layout_toLeftOf="@+id/isSystemAppImageView"
android:ellipsize="marquee"
android:text="description"
tools:ignore="HardcodedText" />
<ImageView
android:id="@+id/isSystemAppImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/appDescriptionTextView"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:contentDescription="@string/content_description_this_is_a_system_app"
android:src="@drawable/stat_sys_warning" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我尝试了多种可能的解决方案:
使用HorizontalListView似乎解决了这个问题,但它不允许点击/长按项目.
我找到了一个很好的库,使textViews有一个"选框"效果(这里),但它的许可证不是那么宽松.
将单元格高度设置为固定高度或将textViews设置为具有固定行数也可以工作,但是它会减少(部分)textViews的内容而无法显示它们.
我也尝试使用linearLayouts而不是RelativeLayout,但它没有帮助.
一个可能的解决方案是获取gridView上所有视图使用的最大高度(在所有项目上使用getView),类似于 …
我有一个带有一些文本的TextView,我想让它用滚动的选框动画制作动画.我看到了关于强制选框动画的这个流行问题,但是答案中的代码只有在文本足够长以超出TextView的边界(因此文本被截断)时才起作用,我正在寻找永久性的解决方案无论文本的宽度如何,都要使文本具有此选取框动画; 这可能吗?
我正在使用文本视图,我已经给了elipzize = marquee,而不是我给这个文本视图的字符串水平滚动但我的问题是我需要检测字幕文本是否已完成并想要加载下一个字符串,我已经给出永远marque所以我不想让文本继续运行我想在文本中改变两件事,所以需要找出它什么时候结束
在这里看到xml
<TextView
android:id="@+id/push_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_gravity="center_vertical"
android:background="#85000000"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:textDirection="anyRtl"
android:marqueeRepeatLimit="marquee_forever"
android:maxLines="1"
android:paddingBottom="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:scrollHorizontally="true"
android:singleLine="true"
android:textColor="#ffffff"
tools:ignore="EllipsizeMaxLines" />
Run Code Online (Sandbox Code Playgroud)
请告诉我如何检测选框文本是否在选框文本的末尾结束,我需要触发其他一些evnet
先感谢您
我得到了需要在底部显示的数据列表,就像 iOS 自动平滑和连续滚动中的新骗子一样。如何实现像 Marquee 到 collectionView 这样的行为,因为我需要索引位置值。
marquee horizontal-scrolling smooth-scrolling uicollectionview swift4