Skip to content

Instantly share code, notes, and snippets.

@Aracem
Last active August 29, 2015 14:10
Show Gist options
  • Save Aracem/ac2f7956558dda2234a3 to your computer and use it in GitHub Desktop.
Save Aracem/ac2f7956558dda2234a3 to your computer and use it in GitHub Desktop.
RoundedActionButton
<?xml version="1.0" encoding="utf-8"?>
<!--
~ /*
~ * Copyright (c) 2014 Rushmore.fm All rights reserved.
~ * 1 1
~ * 101 101
~ * 100010001
~ * 10000000001
~ * 1000000000001
~ *
~ * R U S H M O R E
~ */
-->
<resources>
<color name="btn_default_light_normal">#00000000</color>
<color name="btn_default_light_pressed">#40ffffff</color>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<!--
~ /*
~ * Copyright (c) 2014 Rushmore.fm All rights reserved.
~ * 1 1
~ * 101 101
~ * 100010001
~ * 10000000001
~ * 1000000000001
~ *
~ * R U S H M O R E
~ */
-->
<resources>
<dimen name="btn_fab_size">56dp</dimen>
<dimen name="btn_fab_margins">16dp</dimen>
<dimen name="default_elevation">8dp</dimen>
</resources>
<?xml version="1.0" encoding="utf-8"?>
<!--drawable-v21/btn_fab_default.xml-->
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/fab_color_shadow">
<item>
<shape android:shape="oval">
<solid android:color="@color/style_color_accent" />
</shape>
</item>
</ripple>
<?xml version="1.0" encoding="utf-8"?>
<!--drawable/btn_fab_default.xml-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false">
<layer-list>
<item android:bottom="0dp" android:left="2dp" android:right="2dp" android:top="2dp">
<shape android:shape="oval">
<solid android:color="@color/fab_color_shadow" />
</shape>
</item>
<item android:bottom="2dp" android:left="2dp" android:right="2dp" android:top="2dp">
<shape android:shape="oval">
<solid android:color="@color/style_color_accent" />
</shape>
</item>
</layer-list>
</item>
<item android:state_pressed="true">
<shape android:bottom="2dp" android:left="2dp" android:right="2dp" android:shape="oval" android:top="2dp">
<solid android:color="@color/fab_color_pressed" />
</shape>
</item>
</selector>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<!-- ... -->
<ImageButton
android:id="@+id/btnCreate"
android:layout_width="@dimen/btn_fab_size"
android:layout_height="@dimen/btn_fab_size"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="@dimen/btn_fab_margins"
android:layout_marginRight="@dimen/btn_fab_margins"
android:background="@drawable/btn_fab_default"
android:elevation="@dimen/default_elevation"
android:src="@drawable/ic_instagram_white"
android:textSize="28sp" />
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment