i have a linearlayout as circle and wanted to change it color using value converter.
below is how my linear layout looks
<LinearLayout
android:orientation="vertical"
android:id="@+id/linearLayoutDaysLeft"
android:background="@drawable/RedBackground"
local:MvxBind="BackgroundColor DateColor(EndDate)"/>
note i have set the background as @drawable/RedBackground
below is how my @drawable/RedBackground.xml file looks like
<?xml version="1.0" encoding="utf-8" ?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<corners android:radius="10dip"/>
<solid android:color="#D00E0D"/>
</shape>
Below is my DateColorValueConverter code
protected override Cirrious.CrossCore.UI.MvxColor Convert(object value, object parameter, System.Globalization.CultureInfo culture)
{
var date = (DateTime)value;
int dayLeft;
TimeSpan difference = date - DateTime.Today;
dayLeft = (int)Math.Ceiling(difference.TotalDays);
if (dayLeft < 0)
return (new Cirrious.CrossCore.UI.MvxColor(208, 14, 13, 150));
if (dayLeft >= 0 && dayLeft <= 1)
return (new Cirrious.CrossCore.UI.MvxColor(255, 210, 0, 150));
if (dayLeft > 1)
return (new Cirrious.CrossCore.UI.MvxColor(93, 210, 85, 150));
return (new Cirrious.CrossCore.UI.MvxColor(93, 210, 85, 150));
}
Note my DateColor works as required but when it return the color it remove the cicular shape
Please help me
Thanks
Aaman