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"/>

实现效果(最后一行)

 

posted @ 2023-01-03 20:31  喝着农药吐泡泡o  阅读(23)  评论(0编辑  收藏  举报