RotatingText
介绍:
文字定时过渡效果。
运行效果:
使用说明:
app的 build.gradle
dependencies {
compile 'com.sdsmdg.harjot:rotatingtext:1.0.1'
}
Example Usage 1 (Simple)
xml
<com.sdsmdg.harjot.rotatingtext.RotatingTextWrapper
android:id="@+id/custom_switcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Java
RotatingTextWrapper rotatingTextWrapper = (RotatingTextWrapper) findViewById(R.id.custom_switcher);
rotatingTextWrapper.setSize(35);
Rotatable rotatable = new Rotatable(Color.parseColor("#FFA036"), 1000, "Word", "Word01", "Word02");
rotatable.setSize(35);
rotatable.setAnimationDuration(500);
rotatingTextWrapper.setContent("This is ?", rotatable);
Result
Example Usage 2 (Typeface + Interpolator)
XML
<com.sdsmdg.harjot.rotatingtext.RotatingTextWrapper
android:id="@+id/custom_switcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Java
Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/Raleway-Light.ttf");
Typeface typeface2 = Typeface.createFromAsset(getAssets(), "fonts/Reckoner_Bold.ttf");
RotatingTextWrapper rotatingTextWrapper = (RotatingTextWrapper) findViewById(R.id.custom_switcher);
rotatingTextWrapper.setSize(35);
rotatingTextWrapper.setTypeface(typeface2);
Rotatable rotatable = new Rotatable(Color.parseColor("#FFA036"), 1000, "Word", "Word01", "Word02");
rotatable.setSize(35);
rotatable.setAnimationDuration(500);
rotatable.setTypeface(typeface);
rotatable.setInterpolator(new BounceInterpolator());
rotatingTextWrapper.setContent("This is ?", rotatable);
Result
Example Usage 3 (Multiple Rotatables)
XML
<com.sdsmdg.harjot.rotatingtext.RotatingTextWrapper
android:id="@+id/custom_switcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Java
Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/Raleway-Light.ttf");
Typeface typeface2 = Typeface.createFromAsset(getAssets(), "fonts/Reckoner_Bold.ttf");
RotatingTextWrapper rotatingTextWrapper = (RotatingTextWrapper) findViewById(R.id.custom_switcher);
rotatingTextWrapper.setSize(35);
rotatingTextWrapper.setTypeface(typeface2);
Rotatable rotatable = new Rotatable(Color.parseColor("#FFA036"), 1000, "Word", "Word01", "Word02");
rotatable.setSize(35);
rotatable.setTypeface(typeface);
rotatable.setInterpolator(new AccelerateInterpolator());
rotatable.setAnimationDuration(500);
Rotatable rotatable2 = new Rotatable(Color.parseColor("#123456"), 1000, "Word03", "Word04", "Word05");
rotatable2.setSize(25);
rotatable2.setTypeface(typeface);
rotatable2.setInterpolator(new DecelerateInterpolator());
rotatable2.setAnimationDuration(500);
rotatingTextWrapper.setContent("This is ? and ?", rotatable, rotatable2);
Result
已下载
0