0

Newbie alert here!

I am trying to learn the best way to draw a custom border around an image (e.g. a picture frame) that is comprised of 8 bitmaps- 4 corners + 4 sides that are actually slices that need to be repeated depending on the view size. I understand the best way will be to use a FrameView but I'm not sure about the drawing part, for example how to do the repeating for the images along the sides? Can this be done in XML or do I need to handle OnDraw()? Or should I look at using a 9 patch?

There must be an example somewhere.

StuTheDog
  • 451
  • 1
  • 11
  • 19
  • Take a look here: http://stackoverflow.com/questions/1598119/is-there-an-easy-way-to-add-a-border-to-the-top-and-bottom-of-an-android-view. – Lukasz M Oct 21 '12 at 17:37

1 Answers1

0

I think use of xml is the better approach. try like this ..

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

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

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

    <stroke
        android:width="0.5dp"
        android:color="@color/ashColor" />

</shape>

This may help you.........

bashu
  • 1,710
  • 12
  • 16