Skip to content

Instantly share code, notes, and snippets.

@john-lorrenz
Last active November 18, 2019 03:12
Show Gist options
  • Save john-lorrenz/23af230b320cf13f128dbb02b75be8d7 to your computer and use it in GitHub Desktop.
Save john-lorrenz/23af230b320cf13f128dbb02b75be8d7 to your computer and use it in GitHub Desktop.
Simple Chat Layout Template
implementation 'com.google.android.material:material:1.0.0'
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--
// Add this property to set alignment
android:layout_alignParentRight="true"
-->
<com.google.android.material.card.MaterialCardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardElevation="0dp"
app:cardBackgroundColor="@android:color/black"
app:cardCornerRadius="10dp"
app:contentPadding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi man what's up?"
android:textColor="@android:color/white"/>
</com.google.android.material.card.MaterialCardView>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!--
// Add this property to set alignment
android:layout_alignParentRight="true"
-->
<com.google.android.material.card.MaterialCardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:cardElevation="0dp"
app:cardBackgroundColor="@android:color/black"
app:cardCornerRadius="10dp"
app:contentPadding="10dp"
app:strokeColor="@android:color/darker_gray"
app:strokeWidth="1dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hi man what's up?"
android:textColor="@android:color/white"/>
</com.google.android.material.card.MaterialCardView>
</RelativeLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment