<marqueetext.marquee.iii.marqueetext.MarqueeText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee" //去掉省略号
android:focusable="true" //使其循环
android:focusableInTouchMode="true"
android:singleLine="true" //使其单行
android:text="@string/text_name"
android:id="@+id/textView2" />
<marqueetext.marquee.iii.marqueetext.MarqueeText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:singleLine="true"
android:text="@string/text_name"
android:layout_below="@+id/textView2" />
1、定义textView标签的4个属性:
android:singleLine="true"http://强制单行
android:ellipsize="marquee"http://去掉省略号
android:focusable = "true"http://获取焦点
android : focusableInTouchMode = "true" //触摸获取焦点
2、自定义类继承TextView:
实现三个构造函数;
复写isfocued方法,返回true(默认都有有焦点,平常只有一个有焦点在第一行上。复写之后强制获取焦点)
3、使用自定义的类,方法是用包名和自定义类名代替TextView(src下的包名+类名)
子类永远不会继承父类的构造方法。也就是除了构造方法之外,父类的所有方法和属性都由子类的对象继承。所以,也就谈不到重写的问题了。但是可以用super调用的,而且父类构造方法的调用,总是先于子类构造方法的调用,所以,调用父类构造方法的语句应该为子类构造方法中的第一个语句。。
點擊查看更多內容
1人點贊
評論
評論
共同學習,寫下你的評論
評論加載中...
作者其他優(yōu)質文章
正在加載中
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦