This application updates and shows the user profile consisting of a name and an email address.
The layout file will have one TextView for displaying the user profile, two EditTexts for receiving the new values from the user, and a button:
|
|
| MyFirebase\app\res\layout\activity_main.xml |
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools = "http://schemas.android.com/tools"
android:id = "@+id/activity_main"
android:layout_width = "match_parent"
android:layout_height = "match_parent"
android:orientation = "vertical"
android:paddingBottom = "@dimen/activity_vertical_margin"
android:paddingLeft = "@dimen/activity_horizontal_margin"
android:paddingRight = "@dimen/activity_horizontal_margin"
android:paddingTop = "@dimen/activity_vertical_margin"
tools:context = "com.wenchen.myfirebase.MainActivity">
<TextView
android:id = "@+id/txt_user"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:paddingBottom = "@dimen/activity_horizontal_margin"
android:paddingTop = "@dimen/activity_horizontal_margin"
android:textSize = "20dp" />
<LinearLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:orientation = "vertical">
<com.google.android.material.textfield.TextInputLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content">
<EditText
android:id = "@+id/name"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:hint = "@string/name"
android:inputType = "textCapWords"
android:maxLines = "1" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width = "match_parent"
android:layout_height = "wrap_content">
<EditText
android:id = "@+id/email"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:hint = "@string/email"
android:inputType = "textEmailAddress"
android:maxLines = "1" />
</com.google.android.material.textfield.TextInputLayout>
<Button
android:id = "@+id/btn_save"
style = "?android:textAppearanceSmall"
android:layout_width = "match_parent"
android:layout_height = "wrap_content"
android:layout_marginTop = "16dp"
android:background = "@color/colorPrimary"
android:text = "@string/action_save"
android:textColor = "@android:color/white"
android:textStyle = "bold" />
</LinearLayout>
</LinearLayout>
|