Android TextView 字體滾動(dòng)效果
Android TextView 字體滾動(dòng)效果
實(shí)例代碼:
package com.godinsec.seland.ui.tools;
import android.content.Context;
import android.text.TextUtils.TruncateAt;
import android.util.AttributeSet;
import android.widget.TextView;
public class MarqueTextView extends TextView {
public MarqueTextView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context);
}
public MarqueTextView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
}
public MarqueTextView(Context context) {
super(context);
init(context);
}
private void init(Context context) {
setEllipsize(TruncateAt.MARQUEE) ;
}
@Override
public boolean isFocused() {
return true;
}
}
Android XML:
<com.godinsec.seland.ui.tools.MarqueTextView
android:id="@+id/tv_attention_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:text="XXXXXXXXXXXXXXXXXX"
android:textColor="@color/textcolor_black_b2"
android:textSize="@dimen/text_sp_s3" />
感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
- Android實(shí)現(xiàn)在TextView文字過長(zhǎng)時(shí)省略部分或滾動(dòng)顯示的方法
- android實(shí)現(xiàn)上下滾動(dòng)的TextView
- android TextView不用ScrollViewe也可以滾動(dòng)的方法
- Android中TextView實(shí)現(xiàn)垂直滾動(dòng)和上下滾動(dòng)效果
- Android TextView實(shí)現(xiàn)垂直滾動(dòng)效果的方法
- Android編程實(shí)現(xiàn)TextView垂直自動(dòng)滾動(dòng)功能【附demo源碼下載】
- Android中TextView實(shí)現(xiàn)超過固定行數(shù)顯示“...展開全部”
- Android TextView顯示html樣式的文字
- Android實(shí)現(xiàn)TextView顯示HTML加圖片的方法
- Android開發(fā)實(shí)現(xiàn)TextView顯示豐富的文本
- Android DrawableTextView圖片文字居中顯示實(shí)例
- Android開發(fā)中TextView文本過長(zhǎng)滾動(dòng)顯示實(shí)現(xiàn)方法分析
相關(guān)文章
Android開發(fā)中DatePicker日期與時(shí)間控件實(shí)例代碼
本文通過實(shí)例代碼給大家介紹了Android開發(fā)中DatePicker日期與時(shí)間控件,代碼簡(jiǎn)單易懂,非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下2017-08-08
Android開發(fā)中簡(jiǎn)單設(shè)置啟動(dòng)界面的方法
這篇文章主要介紹了Android開發(fā)中簡(jiǎn)單設(shè)置啟動(dòng)界面的方法,涉及Android界面布局、加載、跳轉(zhuǎn)等相關(guān)操作技巧,需要的朋友可以參考下2018-01-01
Android 自定義控件實(shí)現(xiàn)顯示文字的功能
這篇文章主要介紹了Android 自定義控件實(shí)現(xiàn)顯示文字的功能的相關(guān)資料,需要的朋友可以參考下2016-11-11
Android實(shí)現(xiàn)三角形氣泡效果方式匯總
這篇文章主要介紹了Android實(shí)現(xiàn)三角形氣泡效果方式匯總,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-03-03
Android Activity切換(跳轉(zhuǎn))時(shí)出現(xiàn)黑屏的解決方法 分享
Android Activity切換(跳轉(zhuǎn))時(shí)出現(xiàn)黑屏的解決方法 分享,需要的朋友可以參考一下2013-06-06
Android自定義控件之圓形/圓角的實(shí)現(xiàn)代碼
這篇文章主要為大家詳細(xì)介紹了Android自定義控件之圓形/圓角的實(shí)現(xiàn)代碼,感興趣的小伙伴們可以參考一下2016-03-03
Android RecyclerView自由拖動(dòng)item的實(shí)現(xiàn)代碼
這篇文章主要介紹了Android RecyclerView自由拖動(dòng)item的實(shí)現(xiàn)代碼,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2024-01-01

