使用一个小图片tile平铺到ImageView中或Activity背景

方法两种:

首先必须在res/drawable目录下包含一个background.jpg

方法1:在res/drawable中创建一个xml文件(background_repeat.xml)

              内容为



然后再Activity的xml中



方法2:

      imageView = (ImageView)findViewById(R.id.MainA_Iv);
      Bitmap bitmap = BitmapFactory.decodeResource(getResources(),R.drawable.background);
     
      BitmapDrawable bd = new BitmapDrawable(bitmap);
      bd.setTileModeXY(TileMode.REPEAT , TileMode.REPEAT );
      imageView.setBackgroundDrawable(bd);



你可能感兴趣的:(My,Android)