标签: marquee

Android Marquee

在Android中有Marquee的任何工作示例吗?我浏览了一些网站,但这些例子都没有用.

谢谢你的答案..但是以下代码无论如何都没有用.我使用的是Android 2.2.

       <TextView    
             android:singleLine="true"  
             android:ellipsize="marquee" 
             android:marqueeRepeatLimit ="marquee_forever"
             android:text="Marquee.."/> 
Run Code Online (Sandbox Code Playgroud)

android marquee

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

扩展AppWidgetProvider的Widget中的TextView Marquee是否可能?

我是Android编程的新手,我到处都读过,我似乎无法找到任何解决方案.

基本问题是我在一个小部件中有一个TextView,我希望文本在文本长于TextView layout_width时滚动.这是我在layout_widget.xml中的代码

    <TextView android:id="@+id/fact" android:layout_width="200dp"
            android:text="Loading... More text to see if it spans or not and want more"
            android:singleLine="true" 
            android:ellipsize="marquee"
            android:marqueeRepeatLimit ="marquee_forever"
            android:scrollHorizontally="true"
            android:focusable="true"
            android:focusableInTouchMode="true" />
Run Code Online (Sandbox Code Playgroud)

现在我读到我必须让TextView成为焦点,我已经完成了.我还读过你需要设置属性setSelected(true),这是我努力设置的地方.在我的默认Activity(在AndroidManifest.xml中)中,我有以下代码.

            @Override
            public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.widget_layout);
                findViewById(R.id.fact).setSelected(true);
                setContentView(R.layout.main);
            }
Run Code Online (Sandbox Code Playgroud)

下面的部分用于将Content设置为widget_layout.xml,然后将setSelected的TextView属性设置为true

                setContentView(R.layout.widget_layout);
                findViewById(R.id.fact).setSelected(true);
Run Code Online (Sandbox Code Playgroud)

然后我将ContentView返回给main.xml

现在我猜这是错的,这不是它应该做的方式.但我想知道是否可以做到.我还读到,如果你可以覆盖框架,你可以把你自己的属性,例如ScrollView,这也是正确的吗?我也在使用SDK Version 7.

非常感谢我收到的帮助,谢谢大家!

编辑:删除setContentView(R.layout.main); 当通过应用程序绘制启动应用程序时,文本会滚动,但小部件不会.有点让我知道一个小部件不能有一个选框??? 有没有人在一个小工具上工作?

编辑2:解决了.这就是它的完成方式

在文本视图的xml中你需要有一个标签这基本上我认为与getSeleted(true)相同;

所以代码应该如下:

    <TextView android:id="@+id/fact" android:layout_width="200dp"
            android:text="Loading... More text to see if it spans or not and want more"
            android:singleLine="true" 
            android:ellipsize="marquee"
            android:marqueeRepeatLimit ="marquee_forever"
            android:scrollHorizontally="true"
            android:focusable="true" …
Run Code Online (Sandbox Code Playgroud)

android widget marquee textview android-widget

13
推荐指数
1
解决办法
6862
查看次数

TextView android:ellipsize ="marquee"无法按预期工作

我在ListView中有一些自定义元素,每个元素最多只知道一个LinearLayout中的TextView.我希望TextView中的文本是一个单行,当文本太长时水平滚动.我读了很多关于这个的帖子,我想出了一个应该有效的解决方案,但是我没有完整的文本滚动,而是将文本剪切到包含View的长度并以三个点结束.我不想要三个点,但需要滚动整个文本.

这是列表中项目的布局(list_item.xml)

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/listItem"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/list_item_selector"
    android:orientation="horizontal"
    android:paddingBottom="7dp"
    android:paddingLeft="15dp"
    android:paddingTop="7dp" >

    <TextView
        android:id="@+id/listText"
        style="@style/Text_View_Style_White"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:ellipsize="marquee"
        android:focusableInTouchMode="true"
        android:marqueeRepeatLimit="marquee_forever" 
        android:padding="3dp"

        android:selectAllOnFocus="true"
        android:singleLine="true"
        android:textColor="@drawable/list_item_text_selector" />


</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我也试过用android:focusable="true",android:scrollHorizontally="true"android:maxLines="1"属性,但他们都不是工作.在getView()适配器的方法(扩展BaseAdapter)中,我setSelected(true)在返回View之前使用TextView上的方法.

我无法弄清楚问题是什么.任何帮助将受到高度赞赏.

android marquee textview

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

Javascript Marquee替换<marquee>标签

我对Javascript毫无希望.这就是我所拥有的:

<script type="text/javascript">
    function beginrefresh(){

        //set the id of the target object
        var marquee = document.getElementById("marquee_text");

        if(marquee.scrollLeft >= marquee.scrollWidth - parseInt(marquee.style.width)) {
            marquee.scrollLeft = 0;
        }

        marquee.scrollLeft += 1;

        // set the delay (ms), bigger delay, slower movement
        setTimeout("beginrefresh()", 10);

    }
</script>
Run Code Online (Sandbox Code Playgroud)

它滚动到左边但我需要它相对无缝地重复.目前它只是跳回到开头.这可能不是我做的方式,如果没有,任何人都有更好的方法?

html javascript marquee

12
推荐指数
2
解决办法
8万
查看次数

ie8中的<marquee>问题

我的<marquee>标签在ie6和ie7中完美运行,但在ie8中它只显示第一项.

我怎样才能解决这个问题?

提前致谢.

html css marquee

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

将鼠标悬停在Pause Marquee上

我想创建一个滚动一些新闻文章的Marquee,但是当用户将鼠标悬停在它上面时,我需要它暂停,当用户将其悬停时(onMouseOut)我需要重新启动.这不起作用:

<marquee onMouseOver="this.stop()" onMouseOut="this.start()">Text</marquee>
Run Code Online (Sandbox Code Playgroud)

有没有人对如何在最少量的代码中实现这一点有任何建议?

html javascript css jquery marquee

12
推荐指数
3
解决办法
5万
查看次数

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

<marquee> html标签用法/替换

我知道<marquee>标签是邪恶的.
如果滚动文本太糟糕了,那么使用JS来获得相同的效果并不会让它变得更好,对吧?

并且假设我决定使用一些滚动文本(喘息),是否有某种类型的CSS(3?)或HTML(5?)方式来做到这一点在技术上是正确的(即不被弃用)?

如果没有CSS/HTML解决方案,我应该使用:

  • Javascript,下载会更重,可能会被关闭(是专业人士还是骗子?),但我得到W3C正确有效且不弃用且智能的奖励,

或者我应该使用

  • 讨厌的<marquee>(<blink> <blink>)标签,它是轻量级的(19字节!),在所有渲染模式和所有文档类型中都得到了所有浏览器的完全支持(即使它不应该),但已被弃用?

谢谢.

PS我觉得新闻自动收报机是一个有效的用于选框式
PPS如果有人告诉我,如果我不想要一个繁重的Javascript解决方案我应该使用JQuery因为它是轻量级的,我会在评论中拍摄它们

编辑:我正在添加JQuery标签,因为这似乎是获得许多JS问题专家关注的最佳方式,而且这里并不完全无关.

javascript jquery html5 marquee css3

11
推荐指数
2
解决办法
8620
查看次数

选框应该从中间开始?

我使用marquee在我的网站上显示仪表板,marquee标记写成:

<marquee loop="infinite" behavior="scroll" direction="up" scrollamount="1" height="500" width="500">
    .............
    .............
</marquee>
Run Code Online (Sandbox Code Playgroud)

如您所见,选取框内容从下向上滚动.

问题

当我从浏览器点击URL时,使用选框的位置看起来是空的,然后选取内容从底部开始.

我想要的是选取内容应该从中间而不是从底部开始.

html marquee

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

连续滚动UILabel就像选框一样

以下是我的代码,用于滚动UILabel水平,使其显示为选框效果.但是动画开始于标签位于中心并滚动直到它的宽度,并再次从中心滚动统计数据.我想要从左到右连续滚动字幕.任何身体都可以帮助我.

-(void)loadLabel{

    if (messageView) {
        [messageView removeFromSuperview];
    }

    NSString *theMessage = text;
    messageSize = [theMessage sizeWithFont:font];
    messageView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, messageSize.width, 916)]; //x,y,width,height
    [messageView setClipsToBounds:NO]; // With This you prevent the animation to be drawn outside the bounds.
    [self.view addSubview:messageView];
    lblTime = [[RRSGlowLabel alloc] initWithFrame:CGRectMake(0, 0, messageSize.width, 916)]; //x,y,width,height
    [lblTime setBackgroundColor:[UIColor yellowColor]];
    lblTime.font = font;
    [lblTime setText:theMessage];
    lblTime.glowOffset = CGSizeMake(0.0, 0.0);
    lblTime.glowAmount = 90.0;
    lblTime.glowColor = color;
    [lblTime setClipsToBounds:NO];
    [lblTime setTextColor:color];
    [lblTime setTextAlignment:UITextAlignmentLeft];
    lblTime.frame = messageView.bounds ; //x,y,width,height …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch objective-c marquee uilabel ios

10
推荐指数
0
解决办法
2万
查看次数