寻找解释设计或我的困惑

时间:2019-04-10 07:12:36

标签: android android-layout material-design

我已经在我的登录屏幕上创建了应用程序。我添加了2个EditText字段。

问题或困惑:

以下我用来制作那些EditText的代码

<android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="Username">
            <android.support.design.widget.TextInputEditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:id="@+id/username_et"/>
</android.support.design.widget.TextInputLayout>

上述代码的输出(抱歉,我仅提供了一个字段。):

Image 1

我想了解此代码与我的代码之间的区别:

特别想了解Material,以及如何更改我的TextInputLayout的颜色。

<com.google.android.material.textfield.TextInputLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:hint="@string/shr_hint_username">

   <com.google.android.material.textfield.TextInputEditText
       android:layout_width="match_parent"
       android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>

代码源:Click Here

预先感谢。

1 个答案:

答案 0 :(得分:1)

com.google.android.material取代了旧的支持库,如这篇文章Revised naming for packages and Maven artifacts

旧的支持库android.design.**的映射是新的com.google.android.material.@

Setting up a Material Components theme for Android

Material Components Android TextInputLayout