Android5.0新特性之MaterialDesign

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_37292229/article/details/71439709

MaterialDesign英文官方文档:http://www.google.com/design/spec/material-design/
MaterialDesign极客学院文档:http://wiki.jikexueyuan.com/project/material-design/
谷歌在推出Android5.0之际,退出来全新的Android Design Support Library。现在,咱们介绍一下常用的Material Design设计风格的空间
在build.gradle中添加依赖

    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'

1.使用TextInputLayout实现登录界面

<?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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.labo.mvpsample.LoginActivity">

    <android.support.design.widget.TextInputLayout
        android:id="@+id/tl_username"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center">

        <EditText
            android:id="@+id/et_username"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:hint="username"
            android:maxLength="20"
            android:maxLines="1"/>
    </android.support.design.widget.TextInputLayout>

    <android.support.design.widget.TextInputLayout
        android:id="@+id/tl_password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center">

        <EditText
            android:id="@+id/et_password"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:hint="password"
            android:maxLength="20"
            android:maxLines="1"/>
    </android.support.design.widget.TextInputLayout>
    <Button
        android:text="login"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"/>
</LinearLayout>

2.用CoordinatorLayout实现Toolbar的隐藏和折叠

3.FloatingActionButton的使用
4.用TabLayout实现选项卡的动态滑动效果
5.用NavigationView实现抽屉菜单界面
6.Snackbar的使用

猜你喜欢

转载自blog.csdn.net/weixin_37292229/article/details/71439709