Android 所见所想

toolbar左边留有空白、toolbar两端空白、toolbar两端不能填满布局问题

  
  app:contentInsetEnd="0dp"
  app:contentInsetLeft="0dp"
  app:contentInsetRight="0dp"
  app:contentInsetStart="0dp“

AppBarLayout去掉下端有阴影

  app:elevation="0dp"

判断 n次点击事件

long[] mClicks = new long[n];
view.setOnClickListener(new OnClickListener() {
     @Override
      public void onClick(View v) {
           System.arraycopy(mClicks, 1, mClicks, 0, mClicks.length - 1);
           mClicks[mClicks.length - 1] = SystemClock.uptimeMillis();
           if(mClicks[0] >= (SystemClock.uptimeMillis() - 500)){
                doSomething();
           }
     }
}

快速开平方

float Q_rsqrt( float number ){
        long i;
        float x2, y;
        const float threehalfs = 1.5F;
 
        x2 = number * 0.5F;
        y  = number;
        i  = * ( long * ) &y;                       // evil floating point bit level hacking
        i  = 0x5f3759df - ( i >> 1 );               // what the fuck?
        y  = * ( float * ) &i;
        y  = y * ( threehalfs - ( x2 * y * y ) );   // 1st iteration//      y  = y * ( threehalfs - ( x2 * y * y ) );   // 2nd iteration, this can be removed
 
        return y;
}

你可能感兴趣的:(Android 所见所想)