how to remove the spacing between the image and its background
<p>I am displaying some images in a gridview with the use of imageview.. On clicking each image I am highlighting the image using a nine patch image by setting it as the background resource of the imageview. The highlighting of the image on clicking the mouse click is achieved but i do not want the spacing/padding between the image and the highlight.. i want the highlighting image (nine patch image) to act as the border of the image placed on the imageview on clicking the image.. I am attaching the code below... please someone suggest me something as I am struggling with this problem for days... any help will be useful </p>

<p><strong>Activity class</strong></p>

<pre><code>            public class MultipleDocumentViewActivity extends Activity {

               private GridView grid;
               private ImageView image;
               ImageView selectedView;

               private int selectedPosition;

               private GridAdapter gAdapter;
               private Stack&lt;ImageView&gt; stack;

                 /** Called when the activity is first created. */
                  @Override
                     public void onCreate(Bundle savedInstanceState) {
                        super.onCreate(savedInstanceState);
                        setContentView(R.layout.main);

                         grid = (GridView)findViewById(R.id.grid);
                         stack = new Stack&lt;ImageView&gt;();

                         gAdapter = new GridAdapter(this);
                         grid.setAdapter(gAdapter);
                         grid.setOnItemClickListener(itemClickListener);




                         }
                        private OnItemClickListener itemClickListener = new  OnItemClickListener()    
                         {

                            public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position,
            long id) 
                    {   


                image = (ImageView)view.getTag();
                      if(!stack.empty()) 
                  {
                stack.pop();
                selectedView.setBackgroundResource(0);
                  }

               stack.push(image);

                                                                                                                                                                               image.setBackgroundResource(R.drawable.ged_multiview_document_frame_selected);

        image.setAdjustViewBounds(true);

        selectedPosition = position;
        selectedView = image;


        }





             };
                }
</code></pre>

<p><strong>Adapter Class</strong></p>

<pre><code>        public class GridAdapter extends BaseAdapter 
            {
              private Context context;
              private LayoutInflater layoutInflator = null;
              private ImageView imageView;


                 private Integer[] mThumbnails =                                            {R.drawable.kunfu1,R.drawable.kunfu2,R.drawable.kunfu3,R.drawable.kunfu4};

  public GridAdapter(Context c)
    {
    context = c;

    Log.d("Aditi","Constructor called");
   }



  public int getCount() {

    return mThumbnails.length;
   }

  public Object getItem(int position) {

    return position;
  }

  public long getItemId(int position) {

    return 0;
  }



 public View getView(int position, View grid, ViewGroup parent) 
   {
    Log.d("Aditi", "Position is "+position);
    layoutInflator =                                                                                                         (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

     if(grid == null)
       {
        layoutInflator = LayoutInflater.from(context);


        Log.d("Aditi","getView() method called");

        grid = layoutInflator.inflate(R.layout.mdv_grid_item, null);
        imageView =  (ImageView)grid.findViewById(R.id.grid_item);
        grid.setTag(imageView);
      }
      else
       {
        imageView = (ImageView)grid.getTag();
       }


       imageView.setImageResource(mThumbnails[position]);

       imageView.setScaleType(ImageView.ScaleType.FIT_XY);



      return grid;

  }
</code></pre>

<p>Thanks in advance..</p>

<p>}</p>
