(1) Mainactivity.java
package com.example.android_textview_rollingsubtitles;import java.sql.wrapper;import android.os.bundle;import android.app.activity;import android.text.html;import android.text.textutils;import android.text.textutils.truncateat;import android.text.method.linkmovementmethod;import android.view.menu;import android.widget.textview; public class mainactivity extends activity { private textview textview; @Override protected void OnCreate (bundle savedinstancestate) { super.oncreate ( Savedinstancestate); setcontentview (R.layout.activity_main); textview = (TextView) this.findviewbyid (R.id.textveiw ); string html = "andRoid <font color= ' Blue ' ><a href= ' http://test.com ' >Linux</a></font> System. Pacific Internet provides comprehensive service information for Android phone, including Android phone quotes, parameters, reviews, comparison "; Charsequence charsequence = html.fromhtml (Html); textview.settext (charsequence) //set * * * Light effect textview.setsingleline (True); textview.setellipsize (TextUtils.TruncateAt.MARQUEE); Textview.setmarqueerepeatlimit ( -1); //set inner fill textview.setpadding (5, 5, 5, 5); //Setting width textview.setfocusableintouchmode (true) ; &Nbsp; textview.setfocusable (TRUE); //settings can be clicked on properties textview.setmovementmethod (Linkmovementmethod.getinstance ()); } @Override public boolean oncreateoptionsmenu (Menu menu) { // inflate the menu; this adds items to the action bar if it is present. Getmenuinflater (). Inflate (R.menu.main, menu); return true; }}
(2) Activity.xml
<relativelayout xmlns:android= "Http://schemas.android.com/apk/res/android" xmlns:tools= "Http://schemas.android.com/tools" android:layout_width= "Match_parent" android:layout_height= "Match_parent" android:paddingbottom= "@ Dimen/activity_vertical_margin " android:paddingleft=" @dimen/activity_horizontal_margin " android:paddingright= "@dimen/activity_horizontal_margin" android:paddingtop= "@dimen/activity_vertical_margin" tools:context= ". Mainactivity " > <TextView Android:layout_width= "Fill_parent" android:layout_height= "Wrap_ Content " android:id=" @+id/textveiw " android:focusableintouchmode= "true" android:padding= "10DP" > </TextView> </RelativeLayout>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/2A/02/wKioL1OBXzyibBkLAAEyKCP6g_8786.jpg "title=" Z.jpg " alt= "Wkiol1obxzyibbklaaeykcp6g_8786.jpg"/>