Created
December 7, 2012 04:19
-
-
Save daichan4649/4230729 to your computer and use it in GitHub Desktop.
marquee text (for Android)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it can work?