Android logon Interface

Source: Internet
Author: User

 

 

It feels good to log on to a logon interface on the Internet. Let's share it with you ~ First look:

 



In addition to buttons, cats, and logos, this Demo uses code to implement other UIS.

 


I. background

The background blue gradient is set through an xml file. The Code is as follows:

Background_login.xml


[Html]
<? Xml version = "1.0" encoding = "UTF-8"?>
<Shape xmlns: android = "http://schemas.android.com/apk/res/android">
<Gradient
Android: startColor = "# FFACDAE5"
Android: endColor = "# FF72CAE1"
Android: angle = "45"
/>
</Shape>

StartColor is the color value at the beginning of the gradient, endColor is the color value at the end of the gradient, and angle is the gradient angle. In # FFACDAE5, FF is the Alpha value, AC is the R value of RGB, DA is the G value of RGB, E5 is the B value of RGB, and each value ranges from 00 ~ FF value, that is, transparency, red, green, and blue are 0 ~ 255 of the value, such as to set a specific color, you can view the settings on the PS color reader.

 

Ii. White Circle of rounded corners

The above is not a white box. In fact, the box is white, but a transparent value is set, which is also implemented by an xml file.

Background_login_div.xml


[Html]
<? Xml version = "1.0" encoding = "UTF-8"?>
<Shape xmlns: android = "http://schemas.android.com/apk/res/android">
<Solid android: color = "#55 FFFFFF"/>
<! -- Set rounded corner
Note: bottomRightRadius is in the lower left corner rather than in the lower right corner of bottomLeftRadius -->
<Corners android: topLeftRadius = "10dp" android: topRightRadius = "10dp"
Android: bottomRightRadius = "10dp" android: bottomLeftRadius = "10dp"/>
</Shape>

 


3. Interface Layout

The interface layout is quite simple, so you can directly paste the code ~

Login. xml


[Html]
<? Xml version = "1.0" encoding = "UTF-8"?>
<LinearLayout
Xmlns: android = "http://schemas.android.com/apk/res/android"
Android: orientation = "vertical"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Android: background = "@ drawable/background_login">
<! -- Padding layout_margin margin
Android: layout_alignParentTop: whether the layout is on the top -->

<RelativeLayout
Android: id = "@ + id/login_div"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: padding = "15dip"
Android: layout_margin = "15dip"
Android: background = "@ drawable/background_login_div_bg">
<! -- Account -->
<TextView
Android: id = "@ + id/login_user_input"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_alignParentTop = "true"
Android: layout_marginTop = "5dp"
Android: text = "@ string/login_label_username"
Style = "@ style/normalText"/>
<EditText
Android: id = "@ + id/username_edit"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: hint = "@ string/login_username_hint"
Android: layout_below = "@ id/login_user_input"
Android: singleLine = "true"
Android: inputType = "text"/>
<! -- Password text -->
<TextView
Android: id = "@ + id/login_password_input"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_below = "@ id/username_edit"
Android: layout_marginTop = "3dp"
Android: text = "@ string/login_label_password"
Style = "@ style/normalText"/>
<EditText
Android: id = "@ + id/password_edit"
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content"
Android: layout_below = "@ id/login_password_input"
Android: password = "true"
Android: singleLine = "true"
Android: inputType = "textPassword"/>
<! -- Log on to the button -->
<Button
Android: id = "@ + id/signin_button"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_below = "@ id/password_edit"
Android: layout_alignRight = "@ id/password_edit"
Android: text = "@ string/login_label_signin"
Android: background = "@ drawable/blue_button"/>
</RelativeLayout>

<RelativeLayout
Android: layout_width = "fill_parent"
Android: layout_height = "wrap_content">
<TextView android: id = "@ + id/register_link"
Android: text = "@ string/login_register_link"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_marginLeft = "15dp"
Android: textColor = "#888"
Android: textColorLink = "# FF0066CC"/>
<ImageView android: id = "@ + id/miniTwitter_logo"
Android: src = "@ drawable/cat"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_alignParentRight = "true"
Android: layout_alignParentBottom = "true"
Android: layout_marginRight = "25dp"
Android: layout_marginLeft = "10dp"
Android: layout_marginBottom = "25dp"/>
<ImageView android: src = "@ drawable/logo"
Android: layout_width = "wrap_content"
Android: layout_height = "wrap_content"
Android: layout_toLeftOf = "@ id/miniTwitter_logo"
Android: layout_alignBottom = "@ id/miniTwitter_logo"
Android: paddingBottom = "8dp"/>
</RelativeLayout>
</LinearLayout>

 


4. Java source file

Java source files are relatively simple, just instantiate the Activity and remove the title bar.


[Java]
Package com. mytwitter. aciti.pdf;
 
Import android. app. Activity;
Import android. OS. Bundle;
Import android. view. Window;
 
Public class LoginActivity extends Activity {
@ Override
Public void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
RequestWindowFeature (Window. FEATURE_NO_TITLE );
SetContentView (R. layout. login );
}
}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.