Android学习day03【跑马灯】

这个学习内容很简单,说一下自己笨蛋的点吧

要实现这种情况,我始终没有办法实现(也就是跑马灯,图片没办法显示)

 

 后来发现

  android:layout_width="wrap_content"
        android:layout_height="wrap_content"

应该用

wrap_content

而我用了

match_parent

是不熟悉的锅啦,莫怪莫怪自己

区别就是

match_parent表示让当前控件的大小和父布局的大小一样,也就是由父布局来决定当前控件的大小

wrap_content表示让当前的控件大小能够刚好包含里面的内容,也就是由控件内容决定当前控件的大小

其二

在drawable中添加的图片,名称不能有数字

其三,如何实现跑马灯的效果

复制代码
<TextView
        android:id="@+id/tv_7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="美丽的一天美丽的一天美丽的一天美丽的一天美丽的一天美丽的一天美丽的一天美丽的一天美丽的一天"
        android:textColor="#000000"
        android:textSize="24sp"
        android:singleLine="true"
        android:ellipsize="marquee"
        android:marqueeRepeatLimit="marquee_forever"
        android:focusable="true"
        android:focusableInTouchMode="true"/>
复制代码

实现效果(最后一行)

 

本文作者:TranquilTimber

本文链接:https://www.cnblogs.com/gbrr/p/17023309.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   喝着农药吐泡泡o  阅读(26)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起
🔑