跑马灯源代码
希望对小白有作用:首先献上资料:
arqueeRepeatLimit属性是文字滚动起来
http://xlover.iteye.com/blog/1443280
android:ellipsiz属性:省略文字
http://www.ablanxue.com/prone_9786_1.html
自定义组件
http://www.android100.org/html/201506/22/156711.html
扬名博博客:
http://www.cnblogs.com/insus/archive/2012/03/08/2385223.html
跑马灯布局:详解
http://www.cnblogs.com/AndroidJotting/p/4815449.html
代码如下:
public class paoma extends TextView{
public paoma(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
// TODO Auto-generated constructor stub
}
public paoma(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
}
public paoma(Context context) {
super(context);
// TODO Auto-generated constructor stub
}
@Override
public boolean isFocused() {
return true;
}
}
布局文件如下:
<LinearLayout 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:orientation="vertical"
>
<com.kcw.view.paoma
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:singleLine="true"
android:ellipsize="marquee"
android:marqueeRepeatLimit="marquee_forever"
android:focusable="true"
android:focusableInTouchMode="true"
/>
</LinearLayout>
当然这是最简单的啦,关于图片跑马灯改天奉上