發表文章

目前顯示的是 5月, 2016的文章

Android SetTextColor work without Build.VERSION.SDK_INT checking

Normal : if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M )  {     dynamicTextView.setTextColor(         m_ctx.getResources().getColor(  R.color.black, null ) ); }  else  {     dynamicTextView.setTextColor(         m_ctx.getResources().getColor( R.color.black ) ); } Another Way (Better) : dynamicTextView.setTextColor(      Color.parseColor(  m_ctx.getResources().getString(                                  R.color.black ) ) ); PS.  R.color.black is a value in xml file,  Color.parseColor can convert color string as #AARRGGBB or #RRGGBB.