Skip to content

Instantly share code, notes, and snippets.

@daichan4649
Created December 7, 2012 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daichan4649/4230729 to your computer and use it in GitHub Desktop.
Save daichan4649/4230729 to your computer and use it in GitHub Desktop.
marquee text (for Android)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical" >
<TextView
android:id="@+id/marqueeText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:singleLine="true"
android:textSize="256sp" />
</LinearLayout>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="sensorLandscape"
android:theme="@android:style/Theme.Light.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
showMarqueeText();
}
private void showMarqueeText() {
TextView marquee = (TextView) findViewById(R.id.marqueeText);
marquee.setText(createMarqueeText());
marquee.requestFocus();
}
private String createMarqueeText() {
StringBuilder text = new StringBuilder();
text.append("今日は寒いのではやく帰って、コタツに入って、");
text.append("飲みながらゲレンデ情報見て、");
text.append("腰痛がどうやったら治るのかを考えつつ、");
text.append("ゲレンデのイメトレすることにします");
return text.toString();
}
@laonane
Copy link

laonane commented Oct 14, 2018

it can work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment