Skip to content

Instantly share code, notes, and snippets.

@valokafor
Created December 14, 2021 06:39
Show Gist options
  • Save valokafor/856d489c59e559f6e431ddf0e649a996 to your computer and use it in GitHub Desktop.
Save valokafor/856d489c59e559f6e431ddf0e649a996 to your computer and use it in GitHub Desktop.
Sample Layout File for Login Screen
<?xml version="1.0" encoding="utf-8"?>
<ScrollView 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:background="@android:color/white"
android:fillViewport="true"
android:paddingStart="@dimen/dp_32"
android:paddingEnd="@dimen/dp_32"
android:scrollbars="none"
tools:context=".ui.auth.LoginFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ProgressBar
android:id="@+id/login_progress"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/logo_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/magin_top_logo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/logo"
android:layout_width="@dimen/logo_width"
android:layout_height="@dimen/logo_height"
android:contentDescription="@string/content_description_logo"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.50"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/pronto_login_logo_icon_circle" />
<TextView
android:id="@+id/text_view_app_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/global_margin"
android:gravity="center_horizontal"
android:text="@string/app_name"
android:textAllCaps="true"
android:textColor="@color/brand_blue"
android:textSize="@dimen/text_size_30"
android:fontFamily="@font/poppins_semibold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/logo" />
<TextView
android:id="@+id/text_view_tag_line"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_8"
android:gravity="center_horizontal"
android:text="@string/tag_line"
android:textColor="@color/secondary_text"
android:textSize="@dimen/text_size_18"
android:textStyle="italic"
android:fontFamily="sans-serif-medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text_view_app_name" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/linear_layout_input_fields"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_24"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/logo_container">
<EditText
android:id="@+id/edit_text_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/input_field_background"
android:drawableStart="@drawable/ic_icon_input_email_wrapped"
android:drawablePadding="@dimen/global_margin"
android:hint="@string/hint_email"
android:padding="@dimen/dp_10" />
<EditText
android:id="@+id/edit_text_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_5"
android:background="@drawable/input_field_background"
android:drawableStart="@drawable/ic_icon_input_lock_wrapped"
android:drawablePadding="@dimen/global_margin"
android:hint="@string/hint_current_password"
android:inputType="textPassword"
android:padding="@dimen/dp_10" />
<TextView
android:id="@+id/text_view_forgot_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginTop="@dimen/dp_8"
android:text="@string/forget_password"
android:textColor="@color/brand_blue"
android:textStyle="bold" />
</LinearLayout>
<Button
android:id="@+id/button_sign_in"
style="@style/SignInButtonStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_24"
android:text="@string/sign_in"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linear_layout_input_fields" />
<LinearLayout
android:id="@+id/sign_up_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_8"
android:layout_marginTop="16dp"
android:layout_marginRight="@dimen/dp_8"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/button_sign_in">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/dont_have_an_account"
android:textColor="@color/secondary_text"
android:textSize="@dimen/text_size_16" />
<TextView
android:id="@+id/text_view_signup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_6"
android:clickable="true"
android:text="@string/sign_up"
android:textColor="@color/brand_blue"
android:textSize="@dimen/text_size_16"
android:textStyle="bold" />
</LinearLayout>
<TextView
android:id="@+id/or"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_24"
android:clickable="true"
android:text="@string/or"
android:textColor="@color/secondary_text"
android:textSize="@dimen/text_size_18"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/sign_up_layout" />
<TextView
android:id="@+id/text_view_info"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif"
android:gravity="center_horizontal"
android:text="@string/conditions_text_signin"
android:textSize="@dimen/text_size_14"
app:layout_constraintBottom_toTopOf="@+id/linear_privacy_policy"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/layout_social_login" />
<LinearLayout
android:id="@+id/linear_privacy_policy"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:gravity="center_horizontal|top"
android:orientation="horizontal"
android:padding="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text_view_info"
app:layout_constraintVertical_bias="0.53">
<Button
android:id="@+id/button_privacy_policy"
style="@style/ButtonTextPrivacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_privacy_policy" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/and"
android:textSize="@dimen/text_size_14" />
<Button
android:id="@+id/button_terms_of_service"
style="@style/ButtonTextPrivacy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_terms_of_service" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment