MessageDigest设计风格:

本文详细介绍Google在2015年发布的DesignSupportLibrary,该库包含8个MaterialDesign组件,最低支持Android2.1。文章深入讲解了TextInputLayout的使用方法,包括布局文件配置、hint颜色设置及主题应用。同时,介绍了SnackBar的使用方式,为开发者提供全面的MaterialDesign组件指南。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. 简介

Design Support Library是Google在2015年的IO大会上发布的全新Material Design支持库,在这个support库里面主要包含了 8 个新的 Material Design组件,最低支持 Android 2.1。
安卓的需要:implementation ‘com.android.support:design:28.0.0’
安卓X的不需要
在这里插入图片描述

2.使用

TextInputLayout
布局文件

1 <android.support.design.widget.TextInputLayout
2        android:id="@+id/layout_account"
3        android:layout_width="match_parent"
4        android:layout_height="wrap_content"
5        android:layout_marginLeft="20dp"
6        android:layout_marginRight="20dp"
7        android:layout_marginTop="60dp">
8

9        <EditText
10            android:layout_width="match_parent"
11            android:layout_height="wrap_content" />
12

13    </android.support.design.widget.TextInputLayout>

在EditText中设置textColorHint属性是没有效果的,textColorHint会根据Theme的颜色来显示,只能通过设置Activity的Theme来更改hint的颜色。
•TextInputLayout包裹EditText,注意:TextInputLayout只能有一个子控件

<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
2    <item name="colorPrimary">@color/colorPrimary</item>
3    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
4    <item name="colorAccent">@color/colorAccent</item>
5    <item name="android:textColorHint">@color/color_333333</item>
6</style>

属性:

app:counterEnabled="true"      //设置是否显示字数统计
2app:counterMaxLength="15"      //设置字数统计的最大值
3app:counterOverflowTextAppearance="@style/counterOverFlowAppearance"   //设置超出最大值后的样式
4app:counterTextAppearance="@style/counterAppearance"  

SnackBar:
最普通的SnackBar,只有文字说明,复杂的SnackBar可以带按钮及事件。

Snackbar.make(v, "谢谢浏览我的博客", Snackbar.LENGTH_SHORT).show();  //和Toast很像

其余可以点击连接继续观看
本文借鉴于https://blog.youkuaiyun.com/Fly_li_sir/article/details/79704021

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值