1. Settings for several colors of the same textview:
build=new spannablestringbuilder ("Building name *"); Style.setspan (New Foregroundcolorspan (Color.Black), 0, 5, spannable.span_exclusive_exclusive); Style.setspan (New Foregroundcolorspan (color.red), 5, 6, spannable.span_exclusive_exclusive); Build.settext (style);
Show it: Building name* 2. Determine that the input is not empty:
//the building name cannot be emptyBuilding.addtextchangedlistener (NewTextwatcher () {@Override Public voidBeforetextchanged (Charsequence S,intStartintCountintAfter ) {} @Override Public voidOnTextChanged (Charsequence S,intStartintBefore,intcount) { if(Textutils.isempty (Building.gettext ()) | |Textutils.isempty (Floor.gettext ())|| Textutils.isempty (Telephone.gettext ()) | |Textutils.isempty (Description.gettext ())) {upload.setenabled (false); Toast.maketext (Feedback. This, "Please complete the feedback information", Toast.length_long). Show (); } Else{upload.setenabled (true); }} @Override Public voidaftertextchanged (Editable s) {}});3. Pass a value between two interfaces with a value of double type: sender:
New Intent (selectpoint. this, Feedback. class ); Intent.putextra ("latitude", latitude); Intent.putextra ("Longtitude", longtitude); StartActivity (intent);
Receiving Party:
Intent intent=getintent (); Final double longtitude = Intent.getdoubleextra ("Longtitude", 0); Final double latitude = Intent.getdoubleextra ("latitude", 0);
4. Set the app start dynamic effect (go to: http://blog.csdn.net/nmsoftklb/article/details/12943483)
Public classWelcomeextendsappcompatactivity {PrivateImageView Welcome; @Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate); Setcontentview (R.layout.activity_welcome); Welcome= (ImageView) This. Findviewbyid (R.id.welcome); Alphaanimation Anima=NewAlphaanimation (0.3f, 1.0f); Anima.setduration (3000);//Set the animation display timewelcome.startanimation (anima); Anima.setanimationlistener (NewAnimationimpl ()); } Private classAnimationimplImplementsAnimation.animationlistener {@Override Public voidOnanimationstart (Animation Animation) {welcome.setbackgroundresource (r.drawable.welcome); } @Override Public voidonanimationend (Animation Animation) {skip ();//jump to another page after the animation ends} @Override Public voidonanimationrepeat (Animation Animation) {}}Private voidSkip () {startactivity (NewIntent ( This, Feedback.class)); Finish (); }}
5. Remove the blue default header above the interface
Public class extends Appcompatactivity
Change into
Public class extends Activity
6.edittext tip for Android:hint,edittext default text is Android:text
Some experience of Android development in junior primary school