WEB开发网
开发学院手机开发Android 开发 Live Wallpaper动态壁纸开发 阅读

Live Wallpaper动态壁纸开发

 2011-07-01 20:50:24 来源:本站整理   
核心提示:}private void CreateBars(){ if(mHorizontal) {int narrowColumnWidth = mRectFrame.right / 7;int wideColumnWidth = mRectFrame.right * 5 / 28;int narrowestColumnWid

 }

 private void CreateBars()
 {
  if(mHorizontal)
  {
  int narrowColumnWidth = mRectFrame.right / 7;
  int wideColumnWidth = mRectFrame.right * 5 / 28;
  int narrowestColumnWidth = mRectFrame.right / 21;
  
  int topColumnHeight = mRectFrame.bottom *2/3;
  int middleColumnHeight = mRectFrame.bottom /12;
  
  mColorRectangles[0] = new Rect(0, 0, narrowColumnWidth, topColumnHeight); 
  for (int i = 1; i < 7; i++)
  {
   mColorRectangles[i] = new Rect(mColorRectangles[i - 1].right, 0, mColorRectangles[i - 1].right + narrowColumnWidth, topColumnHeight); 
  }

mColorRectangles[7] = new Rect(0, mColorRectangles[0].bottom, narrowColumnWidth, mColorRectangles[0].bottom + middleColumnHeight); 
  for (int i = 8; i < 14; i++)
  {
   mColorRectangles[i] = new Rect(mColorRectangles[i - 1].right, mColorRectangles[7].top, mColorRectangles[i - 1].right + narrowColumnWidth, mColorRectangles[7].bottom); 
  }

mColorRectangles[14] = new Rect(0, mColorRectangles[7].bottom, wideColumnWidth, mRectFrame.bottom); 
  for (int i = 15; i < 18; i++)
  {
   mColorRectangles[i] = new Rect(mColorRectangles[i - 1].right, mColorRectangles[14].top, mColorRectangles[i - 1].right + wideColumnWidth, mRectFrame.bottom); 
  }

mColorRectangles[18] = new Rect(mColorRectangles[17].right, mColorRectangles[17].top, mColorRectangles[17].right + narrowestColumnWidth, mRectFrame.bottom); 
  for (int i = 19; i < 21; i++)
  {
   mColorRectangles[i] = new Rect(mColorRectangles[i - 1].right, mColorRectangles[14].top, mColorRectangles[i - 1].right + narrowestColumnWidth, mRectFrame.bottom); 
  }
  mColorRectangles[21] = new Rect(mColorRectangles[20].right, mColorRectangles[17].top, mColorRectangles[6].right, mRectFrame.bottom); 

  }
  else
  {
  int narrowColumnWidth = mRectFrame.bottom / 7;
  int wideColumnWidth = mRectFrame.bottom * 5 / 28;
  int narrowestColumnWidth = mRectFrame.bottom / 21;
  
  int topColumnHeight = mRectFrame.right /3;
  int middleColumnHeight = mRectFrame.right /12;
  
  mColorRectangles[0] = new Rect(topColumnHeight, 0, mRectFrame.right, narrowColumnWidth); 
  for (int i = 1; i < 7; i++)
  {
   mColorRectangles[i] = new Rect(topColumnHeight, mColorRectangles[i - 1].bottom, mRectFrame.right, mColorRectangles[i - 1].bottom + narrowColumnWidth); 
  }

mColorRectangles[7] = new Rect(mColorRectangles[0].left + middleColumnHeight, 0, mColorRectangles[0].left, narrowColumnWidth); 
  for (int i = 8; i < 14; i++)
  {
   mColorRectangles[i] = new Rect(mColorRectangles[7].left, mColorRectangles[i - 1].bottom, mColorRectangles[7].right, mColorRectangles[i - 1].bottom + narrowColumnWidth); 
  }

mColorRectangles[14] = new Rect(0, 0, mColorRectangles[7].right,  wideColumnWidth); 
  for (int i = 15; i < 18; i++)
  {
   mColorRectangles[i] = new Rect(0, mColorRectangles[i - 1].bottom, mColorRectangles[7].right, mColorRectangles[i - 1].bottom + wideColumnWidth); 
  }

mColorRectangles[18] = new Rect(0, mColorRectangles[17].bottom, mColorRectangles[7].right, mColorRectangles[17].bottom + narrowestColumnWidth); 
  for (int i = 19; i < 21; i++)
  {
   mColorRectangles[i] = new Rect(0, mColorRectangles[i - 1].bottom, mColorRectangles[7].right, mColorRectangles[i - 1].bottom + narrowestColumnWidth); 

上一页  1 2 3 4 5 6 7 8  下一页

Tags:Live Wallpaper 动态

编辑录入:coldstar [复制链接] [打 印]
赞助商链接