Features to achieve a simple neon effect.
Activity Code
Package com. app. test01; import android. app. activity; import android. OS. bundle; import android. OS. handler; import android. view. view; public class FrameLayoutActivity extends Activity implements Runnable {// defines five color values: private int [] colors = new int [] {0xffffff0000, 0xFF0000FF, 0xFF00FFFF, 0xFFFF00FF, 0xFF00FF00 }; // index private int [] nextColorPoints = new int [] {, 0} for each color value; // index private int currentColorPoint = 0 for the current value; private View [] views; private Handler handler; @ Overrideprotected void onCreate (Bundle savedInstanceState) {// TODO Auto-generated method stubsuper. onCreate (savedInstanceState); setContentView (R. layout. activity_frame); views = new View [] {findViewById (R. id. textView5), findViewById (R. id. textView4), findViewById (R. id. textView3), findViewById (R. id. textView2), findViewById (R. id. textView1)}; handler = new Handler (); handler. postDelayed (this, 300) ;}@ Overridepublic void run () {// TODO Auto-generated method stubint nextColorPoint = currentColorPoint; for (int I = views. length-1; I> = 0; I --) {views [I]. setBackgroundColor (colors [nextColorPoint]); nextColorPoint = nextColorPoints [nextColorPoint];} currentColorPoint ++; if (currentColorPoint = 5) {currentColorPoint = 0;} handler. postDelayed (this, 300 );}}
Layout File
<?xml version="1.0" encoding="utf-8"?><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/textView1" android:layout_width="300dp" android:layout_height="300dp" android:text="TextView" android:layout_gravity="center"/> <TextView android:id="@+id/textView2" android:layout_width="240dp" android:layout_height="240dp" android:text="TextView" android:layout_gravity="center"/> <TextView android:id="@+id/textView3" android:layout_width="180dp" android:layout_height="180dp" android:text="TextView" android:layout_gravity="center"/> <TextView android:id="@+id/textView4" android:layout_width="120dp" android:layout_height="120dp" android:text="TextView" android:layout_gravity="center"/> <TextView android:id="@+id/textView5" android:layout_width="60dp" android:layout_height="60dp" android:text="TextView" android:layout_gravity="center"/> </FrameLayout>