跳至主要内容

博文

目前显示的是标签为“set”的博文

javascript Thread setTimeout

关于setTimeout下面有一个例子,可以帮助深入理解: setTimeout( function () { while ( true ) { } }, 1000); setTimeout( function () { alert( 'end 2' ); }, 2000); setTimeout( function () { alert( 'end 1' ); }, 100); alert( 'end' );       执行的结果是弹出‘end’‘end 1’,然后浏览器假死,就是不弹出‘end 2’。也就是说第一个settimeout里执行的时候是一个死循环,这个直接导致了理论上比它晚一秒执行的第二个settimeout里的函数被阻塞,这个和我们平时所理解的异步函数多线程互不干扰是不符的。

android set listview text color

ArrayAdapter < String > adapter = new ArrayAdapter < String >( this , android . R . layout . simple_list_item_1 , listItems ){ @Override public View getView ( int position , View convertView , ViewGroup parent ) { View view = super . getView ( position , convertView , parent ); TextView textView =( TextView ) view . findViewById ( android . R . id . text1 ); /*YOUR CHOICE OF COLOR*/ textView . setTextColor ( Color . BLUE ); return view ; } }; /*SET THE ADAPTER TO LISTVIEW*/ setListAdapter ( adapter );

android animation set

AnimationSet animationSet= new AnimationSet(getApplicationContext() ,null ) ; animationSet.addAnimation( new AlphaAnimation( 0f , 1f )) ; animationSet.addAnimation( new TranslateAnimation( 0 , 0 , editText_repeat .getHeight() , 0 )) ; animationSet.setDuration(getResources().getInteger(android.R.integer. config_shortAnimTime )) ; editText_repeat .startAnimation(animationSet) ;