Android 头部设置上下滚动的消息列表 TextView (TextSwitcher运用)
来源:互联网 发布:java技术面试常见问题 编辑:程序博客网 时间:2024/06/05 10:16
private TextSwitcher textView;
private Animation anim, anim1;
private int index;
private Timer timer;
private int times = 4000;
private void upAndDownControl(){
textView = (TextSwitcher) layout.findViewById(R.id.home_news_textview);
// 定义视图显示工厂,并设置
textView.setFactory(new ViewFactory() {
public View makeView() {
TextView tv = new TextView(HomeActivity.this);
tv.setTextSize(13);
tv.setEllipsize(TruncateAt.END);
tv.setSingleLine(true);
tv.setTextColor(getResources().getColor(R.color.home_black_7a7a7a));
return tv;
}
});
anim = AnimationUtils.loadAnimation(HomeActivity.this, R.anim.down);
anim1 = AnimationUtils.loadAnimation(HomeActivity.this, R.anim.top);
textView.setInAnimation(anim1);
textView.setOutAnimation(anim);
timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
mHandler.obtainMessage(HOME_NEWSINFO_SCROLL).sendToTarget();
}
}, 1, times);
}
private HandlermHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
if (msg.what == HOME_NEWSINFO_SCROLL) {
if (index >= InfoData.size()) {
index = 0;
}
textView.setText(InfoData.get(index).getTitle());
num= InfoData.get(index).getNum();
index++;
}
}
};
- Android 头部设置上下滚动的消息列表 TextView (TextSwitcher运用)
- Android 实现上下滚动TextSwitcher
- android textView 上下滚动
- Android中自动上下滚动的TextView
- Android-垂直上下滚动的TextView
- Android:TextView的垂直滚动效果,和上下滚动效果
- Android:TextView的垂直滚动效果,和上下滚动效果
- Android:TextView的垂直滚动效果,和上下滚动效果
- 通过TextSwitcher实现上下滚动的广告动画效果
- TextSwitcher上下滚动的实现和处理点击事件
- 实现上下滚动的TextView
- 实现上下滚动的TextView
- 实现上下滚动的TextView
- android TextView 垂直自动滚动字幕实现TextSwitcher
- Android上下滚动的textview(可作为网站公告)
- Android设置带滚动条的TextView
- android中的TextView滚动条的设置
- android中的TextView滚动条的设置
- Redis 列表(List)
- spark-streaming入门(一)
- Android视图切换动画库SwitchLayout的简单使用
- [POJ3070]Fibonacci(矩阵快速幂)
- 使用存储过程
- Android 头部设置上下滚动的消息列表 TextView (TextSwitcher运用)
- 老版本IE下td没有内容为空时不显示边框的解决办法
- java.lang.OutOfMemoryError: unable to create new native thread
- TensorFlow 从入门到精通(六):tensorflow.nn 详解
- Ant工具介绍
- 【CSS】——三大基础选择器以及优先级
- iOS学习之——prepareForSegue:sender:
- LeetCode 141. Linked List Cycle(链表循环)
- Android事件传递