Skip to content

Instantly share code, notes, and snippets.

@martijn00
Last active July 19, 2017 07:24
Show Gist options
  • Save martijn00/671b6fec9b22e842d2c4 to your computer and use it in GitHub Desktop.
Save martijn00/671b6fec9b22e842d2c4 to your computer and use it in GitHub Desktop.
FAB Button using MvvmCross
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:padding="@dimen/element_margin_medium"
android:src="@drawable/icon_add_static"
local:MvxBind="Click ClickCommand"
local:borderWidth="0dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" />
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.refractored.fab.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:layout_margin="16dp"
android:src="@drawable/icon_add_static"
local:MvxBind="Click ClickCommand"
local:fab_colorNormal="@color/colorPrimary"
local:fab_colorPressed="@color/colorPrimaryDark"
local:fab_colorRipple="@color/colorAccent"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true" />
</FrameLayout>
public class Setup : MvxAndroidSetup
{
public Setup(Context applicationContext)
: base(applicationContext)
{
}
protected override IList<Assembly> AndroidViewAssemblies
{
get
{
var assemblies = base.AndroidViewAssemblies;
assemblies.Add(typeof(Android.Support.Design.Widget.FloatingActionButton).Assembly);
assemblies.Add(typeof(com.refractored.fab.FloatingActionButton).Assembly);
return assemblies;
}
}
}
@gokulakshay
Copy link

Well IList doesnt work now and it overrides IEnumerable automatically, still binding doesnt work for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment