默认是下面的属性添加TextView中:android:ellipsize="marquee"                android:focusableInTouchMode="true"                android:gravity="center"                android:marqueeRepeatLimit="marquee_forever"                android:scrollHorizontally="true"                android:singleLine="true"
但是你会发现无效,并且gridview也不可点击,只有自定义Textview代码如下:

package com.shangc.mycar.custom;import android.content.Context;import android.util.AttributeSet;import android.widget.TextView;/** * 自定义textview实现在GridView实现跑马灯的效果,复写view里面的isFocused()方法,默认情况下是不会有效果的, * 而且gridview也不可点击 *  * @author dennis * */public class MyGridViewTextView extends TextView{public MyGridViewTextView(Context context, AttributeSet attrs, int defStyle){super(context, attrs, defStyle);// TODO Auto-generated constructor stub}public MyGridViewTextView(Context context, AttributeSet attrs){super(context, attrs);}@Overridepublic boolean isFocused(){return true;}}使用上面自定义的TextView并且去掉android:focusable="true" 即可。


更多相关文章

  1. Android下实现一个Activity的全屏显示
  2. 2019-08-20 app常用模块布局之viewpager和fragment
  3. 十六、Android(安卓)滑动效果汇总
  4. Android(安卓)滑动效果汇总
  5. 50个Android开发人员必备UI效果源码
  6. 50个Android开发人员必备UI效果源码
  7. 50个Android开发人员必备UI效果源码
  8. 50个Android开发人员必备UI效果源码
  9. 50个Android开发人员必备UI效果源码

随机推荐

  1. mysql5.7.33误删除ibdata文件找回数据的
  2. MySQL 8.0 redo log的深入解析
  3. MySQL 实例无法启动的问题分析及解决
  4. 关于MySQL报警的一次分析处理详解
  5. 浅谈mysql一张表到底能存多少数据
  6. mysql时区查看与设置方法
  7. MySQL truncate table语句的使用
  8. MySQL的加密解密的几种方式(小结)
  9. mysql的联合索引(复合索引)的实现
  10. Mysql性能优化之索引下推