av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

三種方法實現(xiàn)Android平鋪效果

需要實現(xiàn)平鋪效果,大致有幾下幾種方法。

***種,利用系統(tǒng)提供的api實現(xiàn):

 
 
  1. Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.pic); 
  2.  
  3. //bitmap = Bitmap.createBitmap(200, 30, Config.ARGB_8888); 
  4. BitmapDrawable drawable = new BitmapDrawable(bitmap); 
  5. drawable.setTileModeXY(TileMode.REPEAT , TileMode.REPEAT ); 
  6. drawable.setDither(true); 
  7. view.setBackgroundDrawable(drawable);  

 第二種,使用xml來輕松實現(xiàn),貌似是4.0以后出現(xiàn)的:

 
 
  1. android:src="../../@drawable/img" 
  2. Android:tileMode="repeat" />  

第三種,自己畫出來:

 
 
  1. public static Bitmap createRepeater(int width, Bitmap src){ 
  2. int count = (width + src.getWidth() - 1) / src.getWidth(); 
  3.  
  4. Bitmap bitmap = Bitmap.createBitmap(width, src.getHeight(), Config.ARGB_8888); 
  5. Canvas canvas = new Canvas(bitmap); 
  6.  
  7.     for(int idx = 0; idx < count; ++ idx){ 
  8.         canvas.drawBitmap(src, idx * src.getWidth(), 0, null); 
  9.      } 
  10.  
  11.      return bitmap; 
  12. }  

標題名稱:三種方法實現(xiàn)Android平鋪效果
網(wǎng)站路徑:http://uogjgqi.cn/article/dpeogee.html
掃二維碼與項目經(jīng)理溝通

我們在微信上24小時期待你的聲音

解答本文疑問/技術(shù)咨詢/運營咨詢/技術(shù)建議/互聯(lián)網(wǎng)交流