亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么“找不到 android.support.design.widget.TextInputL”

為什么“找不到 android.support.design.widget.TextInputL”

烙印99 2023-03-31 09:21:58
我的 Android Studio 版本是 3.4,我的 compileSdkVersion 29 和 buildToolsVersion“29.0.1”。我想使用 TextInputLayout,但出現此錯誤:缺少類:找不到以下類:- android.support.design.widget .TextInputLayout (Fix Build Path, Edit XML, Create Class) 提示:嘗試構建項目。我搜索了幾天。我添加了這個implementation 'com.android.support:appcompat-v7:29.0.1'implementation 'com.android.support:design:29.0.1'到我的 gradle 文件。但這個錯誤仍然存在。這是我的 xml:<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent">    <com.example.studentv3.tools.RoundImageView        android:id="@+id/admin_layout_pic"        android:layout_width="100dp"        android:layout_height="100dp"        android:layout_centerHorizontal="true"        android:layout_marginTop="100dp"        android:src="@drawable/admin_photo" />    <android.support.design.widget.TextInputLayout        android:id="@+id/tt2"        android:layout_below="@+id/admin_layout_pic"        android:layout_width="match_parent"        android:layout_height="wrap_content">        <EditText            android:id="@+id/admin_login_activity_name_input"            android:layout_width="match_parent"            android:layout_height="50dp"            android:layout_below="@+id/admin_layout_pic"            android:layout_centerHorizontal="true"            android:layout_marginLeft="50dp"            android:layout_marginRight="50dp"            android:layout_marginTop="20dp"            android:background="@drawable/input_box"            android:gravity="center"            android:hint="請輸入賬戶"            android:maxLines="1"            android:paddingLeft="@dimen/input_box_left_padding"            android:textColor="@color/grey_text" />    </android.support.design.widget.TextInputLayout>
查看完整描述

2 回答

?
溫溫醬

TA貢獻1752條經驗 獲得超4個贊

您可以使用材料設計來實現 TextInputEditText 和 TextInputLayout。


使用最新版本的材料設計:


api 'com.google.android.material:material:1.1.0-alpha06'

然后實現如下。


<com.google.android.material.textfield.TextInputLayout

    android:id="@+id/layout_username"

    style="@style/Widget.ChatMe.TextInputLayout"

    android:layout_width="match_parent"

    android:layout_height="wrap_content"

    android:layout_marginStart="32dp"

    android:layout_marginTop="100dp"

    android:layout_marginEnd="32dp"

    app:layout_constraintEnd_toEndOf="parent"

    app:layout_constraintStart_toStartOf="parent"

    app:layout_constraintTop_toTopOf="parent">


    <com.google.android.material.textfield.TextInputEditText

        android:id="@+id/et_username"

        android:layout_width="match_parent"

        android:layout_height="match_parent"

        android:hint="Username" />

</com.google.android.material.textfield.TextInputLayout>


查看完整回答
反對 回復 2023-03-31
?
慕容3067478

TA貢獻1773條經驗 獲得超3個贊

<com.google.android.material.textfield.TextInputLayout

            android:id="@+id/in1"

            android:layout_width="match_parent"

            android:layout_marginTop="20dp"

            android:layout_gravity="center"

            android:gravity="center"

            android:textColorHint="#353536"

            android:layout_marginLeft="15dp"

            android:layout_marginRight="15dp"

            android:layout_height="wrap_content"

            app:passwordToggleEnabled="true">


            <EditText

                android:id="@+id/loginPass"

                android:layout_width="match_parent"

                android:layout_height="wrap_content"

                android:layout_centerHorizontal="true"

                android:ems="10"

                android:inputType="textPassword"

                android:hint="@string/loginPassword"

                android:paddingLeft="10dp" />

</com.google.android.material.textfield.TextInputLayout>


查看完整回答
反對 回復 2023-03-31
  • 2 回答
  • 0 關注
  • 145 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號