Android TextView 字體滾動效果
更新時間:2017年01月21日 09:00:54 投稿:lqh
這篇文章主要介紹了Android TextView 字體滾動效果的相關(guān)資料,需要的朋友可以參考下
Android TextView 字體滾動效果
實例代碼:
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" />
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
您可能感興趣的文章:
- Android實現(xiàn)在TextView文字過長時省略部分或滾動顯示的方法
- android實現(xiàn)上下滾動的TextView
- android TextView不用ScrollViewe也可以滾動的方法
- Android中TextView實現(xiàn)垂直滾動和上下滾動效果
- Android TextView實現(xiàn)垂直滾動效果的方法
- Android編程實現(xiàn)TextView垂直自動滾動功能【附demo源碼下載】
- Android中TextView實現(xiàn)超過固定行數(shù)顯示“...展開全部”
- Android TextView顯示html樣式的文字
- Android實現(xiàn)TextView顯示HTML加圖片的方法
- Android開發(fā)實現(xiàn)TextView顯示豐富的文本
- Android DrawableTextView圖片文字居中顯示實例
- Android開發(fā)中TextView文本過長滾動顯示實現(xiàn)方法分析
相關(guān)文章
如何使用Mock修改Android設(shè)備上的features
這篇文章主要介紹了如何使用Mock修改Android設(shè)備上的features,想了解Mock的同學(xué)可以參考下2021-04-04
Android中TabLayout+ViewPager實現(xiàn)tab和頁面聯(lián)動效果
本篇文章主要介紹了Android中TabLayout+ViewPager實現(xiàn)tab和頁面聯(lián)動效果,具有一定的參考價值,有興趣的可以了解一下2017-06-06
100 行代碼實現(xiàn)Flutter自定義TabBar的示例代碼
這篇文章主要介紹了100 行代碼實現(xiàn)Flutter自定義TabBar的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-09-09
20行Android代碼寫一個CircleImageView
這篇文章主要介紹了20行Android代碼寫一個CircleImageView,制作圓形頭像,感興趣的小伙伴們可以參考一下2016-08-08
Android進階Hook攔截系統(tǒng)實例化View過程實現(xiàn)App換膚功能
這篇文章主要為大家介紹了Android進階Hook攔截系統(tǒng)實例化View過程實現(xiàn)App換膚功能詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪2023-01-01
Android使用 Retrofit 2.X 上傳多文件和多表單示例
本篇文章主要介紹了Android使用 Retrofit 2.X 上傳多文件和多表單示例,具有一定的參考價值,有興趣的小伙伴一起來了解一下2017-08-08
android bitmap compress(圖片壓縮)代碼
android bitmap compress(圖片壓縮)代碼,需要的朋友可以參考一下2013-06-06

