0

I have a custom imageview which i want to create a white border around. While doing some reasearche if get advice to create a code like this but i dont work, The imageview is a thumbnail image from a youtube video and showed in a listview.

        mImage = new ImageView(mContext);
    mImage.setLayoutParams(new LayoutParams(100, 100));
    mImage.setVisibility(View.GONE);
    mImage.setBackgroundColor(Color.WHITE);
    mImage.setPadding(1, 1, 1, 1);

This is not the full part of the code, please tell if i need to post more. It doesnt make a 1dp/px padding around the picture. It makes like something about 20dp up and down and maybe 1 at left and right. I want it to create a small border around the image.

Ukjent
  • 823
  • 2
  • 9
  • 26
  • Looks like this might answer your question: http://stackoverflow.com/questions/3263611/border-for-an-image-view-in-android – Nick Apr 22 '12 at 03:02

2 Answers2

0

image_background is below

LinearLayout _imageViewFriendLayout = new LinearLayout(this);
                _imageViewFriendLayout.setBackgroundResource(R.drawable.image_background);
                _imageViewFriendLayout.setPadding(2, 2, 2, 2);

                WebView _imageViewFriend = new WebView(this);
                LayoutParams _imageViewFriendParam = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
                _imageViewFriendParam.width = convertDipToPx(65);
                _imageViewFriendParam.height = convertDipToPx(65);
c2dm
  • 219
  • 1
  • 3
0
<?xml version="1.0" encoding="UTF-8"?>

<solid android:color="#FFFFFF" />

<stroke android:width=".5dp"
        android:color="#808080" />

<corners 
        android:bottomRightRadius="0dp"
        android:bottomLeftRadius="0dip"
        android:topLeftRadius="0dip"
        android:topRightRadius="0dp"/>

c2dm
  • 219
  • 1
  • 3