0

Here i have attached the screenshot of my requirement.Background color can be changed. Can anyone give some idea to achieve this.

enter image description here

Thanks in advance.

Priya
  • 672
  • 1
  • 5
  • 21

2 Answers2

0

try this in your imageview

android:background="@drawable/custom_background"
android:src="@drawable/profile"

create a drawable file like this in res/drawable

 <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >

<gradient
    android:angle="90"
    android:endColor="@color/colorPrimary"
    android:startColor="@color/colorPrimaryDark"
    android:centerColor="@color/colorAccent" />

<corners android:radius="0dp" />
</shape>
AskNilesh
  • 67,701
  • 16
  • 123
  • 163
0
android:background="@drawable/gradient"

Note: Please change color code as per your requirement

****gradient.xml****

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<corners
android:radius="14dp"
/>
<gradient
android:angle="45"
android:centerX="35%"
android:centerColor="@color/white" 
android:startColor="#6d0d18"
android:endColor="#d50225"
android:type="linear"
/>
<padding
android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp"
/>
<size
android:width="100dp"
android:height="42dp"
/>
<stroke
android:width="3dp"
android:color="#878787"
/>
</shape>
[Output:][1]


  [1]: [https://i.stack.imgur.com/IjSez.png][1]