private void setupImageContainer ( ) { Resources res = getResources ( ) ; Bitmap bitmap = BitmapFactory . decodeResource ( getResources ( ) , R . drawable . grid ) ; int cellH = ( int ) TypedValue . applyDimension ( TypedValue . COMPLEX_UNIT_DIP , 22 , res . getDisplayMetrics ( ) ) ; bitmap = Bitmap . createScaledBitmap ( bitmap , cellH , cellH , true ) ; BitmapDrawable bitmapDrawable = new BitmapDrawable ( res , bitmap ) ; bitmapDrawable . setTileModeX ( Shader . TileMode . REPEAT ) ; bitmapDrawable . setTileModeY ( Shader . TileMode . REPEAT ) ; mImageContainer . setBackgroundDrawable ( bitmapDrawable ) ; }
Setup image container