Hello user, If you are making a chat app in Android Studio then you are in the right place. In this Article I will provide simple chat app layout UI UX design xml code. It will help you to make a good chat application and also it is responsible for all sizes of Android devices. You can also visit our homepage for getting content related to Android Studio java. This prebuild designs, utils which we provided completely free, it will save your time for making a project and also help you if you are a beginner in this field. Here I have attached some screenshots of this design. I have tried to make this simple as possible. Because users always like simple and clean ui designs. You can make necessary changes to this code according to your need and also interest.
Chat activity layout and Adapter
Here I have given two files one for activity layout and another for RecyclerView adapter.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
android:orientation="vertical"
tools:context=".ChatActivity">
<LinearLayout
android:layout_width="match_parent"
android:background="@color/purple_500"
android:gravity="center_vertical"
android:layout_height="50dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textStyle="bold"
android:layout_marginLeft="10dp"
android:textSize="18sp"
android:layout_weight="1"
android:text="@string/app_name"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/adLayout"
android:gravity="center"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_height="50dp"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"/>
<LinearLayout
android:layout_width="match_parent"
android:gravity="center"
android:layout_marginBottom="8dp"
android:layout_marginTop="8dp"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputLayout
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginRight="8dp"
android:layout_marginLeft="8dp"
android:layout_weight="1"
android:hint="Message"
tools:ignore="HardcodedText,RtlHardcoded">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/chatEdittext"
android:layout_width="match_parent"
android:maxHeight="150dp"
android:textColor="@color/black"
android:alpha="0.7"
android:inputType="textEmailAddress"
android:maxLines="1"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
<androidx.cardview.widget.CardView
android:layout_width="wrap_content"
android:layout_marginRight="8dp"
app:cardCornerRadius="4dp"
android:id="@+id/sendButton"
app:cardBackgroundColor="#8A0B44"
android:layout_height="wrap_content">
<ImageView
android:layout_width="20dp"
android:src="@drawable/ic_baseline_send_24"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="7dp"
android:layout_marginBottom="7dp"
android:layout_height="20dp"/>
</androidx.cardview.widget.CardView>
</LinearLayout>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/linear1"
android:layout_width="match_parent"
android:gravity="center_vertical"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView"
android:layout_width="40dp"
android:alpha="0.6"
android:layout_marginLeft="8dp"
android:src="@drawable/ic_baseline_account_circle_24"
android:layout_height="40dp"/>
<androidx.cardview.widget.CardView
android:id="@+id/cardColor"
android:layout_width="wrap_content"
android:layout_margin="8dp"
app:cardBackgroundColor="#0091EA"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/moreButton"
android:layout_width="20dp"
android:src="@drawable/ic_baseline_more_vert_24"
android:alpha="0.8"
android:layout_gravity="right"
android:padding="3dp"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_height="20dp" />
<LinearLayout
android:layout_width="wrap_content"
android:padding="10dp"
android:orientation="vertical"
android:layout_marginLeft="4dp"
android:layout_height="wrap_content">
<TextView
android:id="@+id/emailText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:textStyle="bold"
android:alpha="0.8"
android:layout_marginRight="30dp"
android:text=""/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" "
android:textColor="@color/white"
android:layout_marginBottom="10dp"
android:alpha="0.8"
android:layout_marginTop="10dp"
android:id="@+id/chatText"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/adLayout"
android:gravity="center"
android:layout_width="300dp"
android:layout_height="250dp"
android:visibility="gone"
android:orientation="vertical"/>
</LinearLayout>
</LinearLayout>
Now add drawble files from Android studio from vector asset.
Thank you for visiting our site. If you find this helpful then please visit our Youtube chennal and subscribe. If you get any error then you can comment below the post or contect us directly. If you need any project according to your interest then comment below. You will try to cover the topic as soon as possible. Thank you
0 Comments