The path of Android Practice (ii)

Source: Internet
Author: User

Project's GitHub address: Https://github.com/Qunter/SearchAndCall

------------------------------------------------------------------------

Today, there are a lot of classes, today, the login page to do it, anyway button style definition, background image found after the registration page is also very quickly, tomorrow will be the registration page completed and the corresponding function to achieve

Or in the Activity_login that was built earlier.

The effect of the final implementation is basically this

Start with the button, first you have to have a shape to define, make him a fillet button

Shape_button.xml

<?XML version= "1.0" encoding= "Utf-8"?><Shapexmlns:android= "Http://schemas.android.com/apk/res/android">    <SolidAndroid:color= "#00ff00ff"/>    <CornersAndroid:radius= "8px"/>    <StrokeAndroid:color= "#ffffff"Android:width= "2px"/></Shape>

The color in solid is actually not important, the main thing is the front 00, let it become transparent

Then to achieve the ripple effect, so there is

Ripple_button.xml

<?XML version= "1.0" encoding= "Utf-8"?><Ripplexmlns:android= "Http://schemas.android.com/apk/res/android"Android:color= "#FF21272B">    <Item>        <ShapeAndroid:shape= "Rectangle">            <SolidAndroid:color= "#0099FF" />            <CornersAndroid:radius= "10DP" />        </Shape>    </Item>    <Itemandroid:drawable= "@drawable/shape_button" /></Ripple>

And then you just have to quote this Ripple_button in the background in the button.

Then the white base color of these controls, we use a linearlayout to achieve, or define a shape, but this time we do not have to do a transparent color

Background_white.xml

<?XML version= "1.0" encoding= "Utf-8"?><Shapexmlns:android= "Http://schemas.android.com/apk/res/android"Android:shape= "Rectangle">    <SolidAndroid:color= "#ffffff"/>    <CornersAndroid:radius= "8DP"/></Shape>

Finally, use it in Activity_login.

<?XML version= "1.0" encoding= "Utf-8"?><Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"android:orientation= "vertical"Android:layout_width= "Match_parent"Android:layout_height= "Match_parent"Android:background= "@drawable/background">    <ImageViewAndroid:layout_width= "200DP"Android:layout_height= "Wrap_content"android:src= "@drawable/backgroundlogo"Android:id= "@+id/imageview"Android:layout_margintop= "50DP"Android:layout_alignparenttop= "true"Android:layout_centerhorizontal= "true" />    <LinearLayoutAndroid:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:layout_margintop= "170DP"Android:background= "@drawable/background_white"android:orientation= "vertical"Android:layout_marginleft= "16DP"Android:layout_marginright= "16DP">        <EditTextAndroid:layout_width= "Match_parent"Android:layout_height= "50DP"Android:layout_margintop= "20DP"Android:layout_marginleft= "16DP"Android:layout_marginright= "16DP"Android:id= "@+id/login_account"Android:singleline= "true"Android:hint= "Account/Phone number/email"Android:drawableright= "@drawable/id"android:drawablepadding= "5DP"/>        <EditTextAndroid:layout_width= "Match_parent"Android:layout_height= "50DP"Android:layout_margintop= "20DP"Android:layout_marginleft= "16DP"Android:layout_marginright= "16DP"Android:singleline= "true"Android:id= "@+id/login_password"Android:drawableright= "@drawable/password"android:drawablepadding= "5DP"Android:inputtype= "Textpassword"Android:hint= "Login Password"/>        <ButtonAndroid:layout_width= "Match_parent"Android:layout_height= "40DP"Android:layout_margintop= "20DP"Android:layout_marginleft= "16DP"Android:layout_marginright= "16DP"Android:background= "@drawable/ripple_button"Android:textcolor= "#ffffff"Android:text= "Login"/>        <ButtonAndroid:layout_width= "Match_parent"Android:layout_height= "40DP"Android:layout_margintop= "20DP"Android:layout_marginleft= "16DP"Android:layout_marginright= "16DP"Android:background= "@drawable/ripple_button"Android:textcolor= "#ffffff"Android:text= "Register"/>        <ButtonAndroid:layout_width= "Match_parent"Android:layout_height= "40DP"Android:layout_margintop= "16DP"Android:layout_marginleft= "16DP"Android:layout_marginright= "16DP"Android:layout_marginbottom= "16DP"Android:background= "@null"Android:textcolor= "#0099ff"Android:text= "Forgot password"Android:id= "@+id/button" />    </LinearLayout></Relativelayout>

It's done.

I feel like I haven't done much today. But on the most days of the class, the evening is still something, but also very helpless

The path of Android Practice (ii)

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.