in this tutorial, we will show you how to design the user interface of a beautiful login activity using android studio, in the second part of this tutorial we will show you how can we activate our login form by adding some java code.
Create a new Project
let's start by opening Android Studio and create a new project
- type the project name and choose the minimum API level and click on finish
N.B: it's better to choose API 16: Android 4.4
and now let's start to code our user interface for that select the "activity_main.xml" and place the code bellow
N.B: for this tutorial, we will use an image as a background for our first TextView so you can choose any image that you want and place it inside the folder Drawable, also we will create a custom shape for the background of the button.
Activity_main.xml
<?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:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="tn.qmed.custombutton.MainActivity" > <TextView android:layout_width="match_parent" android:layout_height="180dp" android:text="Login" android:paddingVertical="35dp" android:textAlignment="center" android:textSize="60sp" android:fontFamily="cursive" android:textColor="@color/colorblack" android:background="@drawable/bgtext" android:layout_marginBottom="25dp" /> <TextView android:layout_width="match_parent" android:layout_marginHorizontal="30dp" android:layout_height="wrap_content" android:text="User name" android:textColor="@color/colorAccent" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginHorizontal="30dp" /> <TextView android:layout_width="match_parent" android:layout_marginHorizontal="30dp" android:layout_height="wrap_content" android:text="Password" android:textColor="@color/colorAccent" /> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="Password" android:inputType="textPassword" android:paddingHorizontal="12dp" android:paddingVertical="20dp" android:layout_marginHorizontal="30dp" /> <Button android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Login" android:layout_marginHorizontal="30dp" android:layout_marginVertical="20dp" android:background="@drawable/button_bg" android:textColor="@color/colorWhite" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="No Account yet? create One" android:layout_marginHorizontal="30dp" android:textAlignment="center" /> </LinearLayout>
before you run the code let's create a custom a new file called "button_bg.xml" inside the drawable folder
and copy this code inside that file
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:startColor="#7613ff" android:endColor="#f91cff" > </gradient> <corners android:radius="50dp"> </corners> </shape>
and that's it you can run your project and see how it will look like.
Make a Login Activity in Android Studio Part 1 : UI DESIGN
Reviewed by Medics
on
September 03, 2019
Rating:
nice designs i would like to see more, thanks for sharing.
ReplyDelete<a href="https://www.dynamisers.com/ui-designing-in-delhi/> Best UI Designs </a>
nice...
ReplyDeleteVery inspiring article for us Thanks for the great article. …. It’s definitely a good idea for me and my friends to learn the things that’ll expand their skill set. Your ideas and presentation is very effective and useful for all. I am loving all of the in turn you are sharing with each one!…
ReplyDeleteBeing a user i really like your visible information on this page
Website Designing