Skip to content

Instantly share code, notes, and snippets.

@gabrielemariotti
Last active Dec 22, 2016
Embed
What would you like to do?
UndoBar with Material Design

These layouts provide a simple undo bar with Material Design.

This gist does not contain any Android L API.

undobar with action undobar mobile
Screen Screen
<string name="font_fontFamily_medium">sans-serif</string>
<string name="font_fontFamily_regular">sans-serif</string>
<style name="undoBar_material">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">56dp</item>
<item name="android:layout_gravity">bottom</item>
<item name="android:layout_marginLeft">32dp</item>
<item name="android:layout_marginRight">32dp</item>
<item name="android:layout_marginBottom">24dp</item>
<item name="android:paddingBottom">18dp</item>
<item name="android:paddingTop">18dp</item>
<item name="android:paddingLeft">24dp</item>
<item name="android:paddingRight">24dp</item>
<item name="android:orientation">horizontal</item>
<item name="android:background">#323232</item>
<item name="android:clickable">true</item>
</style>
<style name="undoBarMessage_material">
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_gravity">center_vertical</item>
<item name="android:layout_marginLeft">0dp</item>
<item name="android:layout_marginRight">24dp</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">#fff</item>
</style>
<style name="undoBarButton_material">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">match_parent</item>
<item name="android:gravity">right</item>
<item name="android:background">?android:selectableItemBackground</item>
<item name="android:textSize">14sp</item>
<item name="android:layout_marginLeft">24dp</item>
<item name="android:textAllCaps">true</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#4CAF50</item>
<item name="android:text">@string/list_card_undo_title</item>
</style>
<style name="undoBar_materialmobile">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">56dp</item>
<item name="android:layout_gravity">bottom</item>
<item name="android:layout_marginLeft">0dp</item>
<item name="android:layout_marginRight">0dp</item>
<item name="android:layout_marginBottom">0dp</item>
<item name="android:paddingBottom">18dp</item>
<item name="android:paddingTop">18dp</item>
<item name="android:paddingLeft">24dp</item>
<item name="android:paddingRight">24dp</item>
<item name="android:orientation">horizontal</item>
<item name="android:background">#323232</item>
<item name="android:clickable">true</item>
</style>
<style name="undoBarMessage_materialmobile">
<item name="android:layout_width">0dp</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_gravity">center_vertical</item>
<item name="android:layout_marginLeft">0dp</item>
<item name="android:layout_marginRight">24dp</item>
<item name="android:textSize">14sp</item>
<item name="android:textColor">#fff</item>
</style>
<style name="undoBarButton_materialmobile">
<item name="android:layout_gravity">center_vertical|right</item>
<item name="android:gravity">right</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_marginLeft">0dp</item>
<item name="android:layout_marginRight">0dp</item>
<item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">0dp</item>
<item name="android:background">?android:selectableItemBackground</item>
<item name="android:textSize">14sp</item>
<item name="android:textAllCaps">true</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#4CAF50</item>
<item name="android:text">@string/list_card_undo_title</item>
</style>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/undobar"
style="@style/undoBar_material"
android:orientation="horizontal">
<TextView
tools:text="Marked as read"
android:id="@+id/undobar_message"
android:fontFamily="@string/font_fontFamily_regular"
style="@style/undoBarMessage_material"/>
<TextView
android:id="@+id/undobar_button"
android:fontFamily="@string/font_fontFamily_medium"
style="@style/undoBarButton_material"/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/undobar"
style="@style/undoBar_materialmobile"
android:orientation="horizontal">
<TextView
tools:text="Marked as read"
android:id="@+id/undobar_message"
android:fontFamily="@string/font_fontFamily_regular"
style="@style/undoBarMessage_materialmobile"/>
<TextView
android:id="@+id/undobar_button"
android:fontFamily="@string/font_fontFamily_medium"
style="@style/undoBarButton_materialmobile"/>
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment