How to Use border as an image in android xml
Posted
by
Ethan Hunt
on Stack Overflow
See other posts from Stack Overflow
or by Ethan Hunt
Published on 2012-11-23T10:57:33Z
Indexed on
2012/11/23
10:59 UTC
Read the original article
Hit count: 262
android-layout
I have a popup to show in my xml. It should have a border. Following is the code:-
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rl_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="20dp" >
<RelativeLayout
android:id="@+id/rl_startpopup"
android:layout_width="340dp"
android:layout_height="320dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/popup_outline"
android:orientation="vertical" />
</RelativeLayout>
The popup_outline is a shape
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<gradient
android:angle="270"
android:endColor="#192423"
android:startColor="#4a7669"
android:type="linear" />
<corners android:radius="8dp" />
<stroke
android:width="2dp"
android:color="#e4f4d3" />
</shape>
here is the image of the popup:-
This "popup_outline" is the white border shown. I want to use a repeatable pattern image instead of one color as the border. I have to do this in xml. Please help
© Stack Overflow or respective owner