您的位置:首页 > 移动开发 > Android开发

解决复杂布局中跑马灯不能跑的问题

2016-11-24 15:48 239 查看
自定义textView


package com.lisn.ds_test;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

/**
* Created by lishan
* 解决复杂布局中跑马灯不能跑的问题
*/
public class MarqueeTextView extends TextView {
public MarqueeTextView(Context context) {
super(context);
}

public MarqueeTextView(Context context, AttributeSet attrs) {
super(context, attrs);
}

public MarqueeTextView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}

@Override
public boolean isFocused() {
return true;
}
}


布局中代码

<com.lisn.ds_test.MarqueeTextView
android:id="@+id/mtv"
android:ellipsize="marquee"
android:focusable="true"
android:singleLine="true"
android:focusableInTouchMode="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>


                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Android 跑马灯
相关文章推荐