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.

4

1 回答 1

0

我认为使用 xml 是更好的方法。试试这样..

<?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>

这可能会帮助你......

于 2012-10-21T17:34:01.713 回答