<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="rectangle" >
<!-- View background color --><solidandroid:color="@color/background_color" ></solid>
<!-- View border color and width --><strokeandroid:width="1dp"android:color="@color/border_color" ></stroke>
<!-- The radius makes the corners rounded --><cornersandroid:radius="2dp" ></corners>
</shape>
<LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical" >
<TextViewandroid:id="@+id/textview1"android:layout_width="match_parent"android:layout_height="wrap_content" />
<!-- This adds a border between the TextViews --><Viewandroid:layout_width="match_parent"android:layout_height="2dp"android:background="@android:color/black" />
<TextViewandroid:id="@+id/textview2"android:layout_width="match_parent"android:layout_height="wrap_content" />
</LinearLayout>
/*** Because creating a border is Rocket Science in Android.*/public class BorderDrawer{public static ImageView generateBorderImageView(Context context, int borderWidth, int borderHeight, int borderThickness, int color){ImageView mask = new ImageView(context);
// Create the square to serve as the maskBitmap squareMask = Bitmap.createBitmap(borderWidth - (borderThickness*2), borderHeight - (borderThickness*2), Bitmap.Config.ARGB_8888);Canvas canvas = new Canvas(squareMask);
Paint paint = new Paint();paint.setStyle(Paint.Style.FILL);paint.setColor(color);canvas.drawRect(0.0f, 0.0f, (float)borderWidth, (float)borderHeight, paint);
// Create the darkness bitmapBitmap solidColor = Bitmap.createBitmap(borderWidth, borderHeight, Bitmap.Config.ARGB_8888);canvas = new Canvas(solidColor);
paint.setStyle(Paint.Style.FILL);paint.setColor(color);canvas.drawRect(0.0f, 0.0f, borderWidth, borderHeight, paint);
// Create the masked version of the darknessViewBitmap borderBitmap = Bitmap.createBitmap(borderWidth, borderHeight, Bitmap.Config.ARGB_8888);canvas = new Canvas(borderBitmap);
Paint clearPaint = new Paint();clearPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
canvas.drawBitmap(solidColor, 0, 0, null);canvas.drawBitmap(squareMask, borderThickness, borderThickness, clearPaint);
clearPaint.setXfermode(null);
ImageView borderView = new ImageView(context);borderView.setImageBitmap(borderBitmap);
return borderView;}}