更新Android库会导致我的代码出错吗?

问题描述 投票:0回答:1

我正在使用implementation group: 'com.google.android.material', name: 'material', version: '1.1.0-alpha05'库以渲染材质组件,但随后我将库更新为implementation group: 'com.google.android.material', name: 'material', version: '1.2.0-alpha03'一切都不好了我困惑了一个小时,问自己在哪里做错了?

这是我必须经历的错误:

更新之前:

This is the Image

更新后:

This is the Image

我的代码有问题还是是更新库的错误。

这是XML中的代码:

<com.google.android.material.textfield.TextInputLayout
                android:id="@+id/DescriptionLayout"
                style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="10dp"
                android:layout_marginRight="10dp"
                android:foregroundGravity="top"
                android:gravity="top"
                android:hint="@string/DescriptionHint"
                app:boxStrokeColor="@color/BoxColor"
                app:hintTextColor="@color/BoxColor">

                <com.google.android.material.textfield.TextInputEditText
                    android:id="@+id/DescriptionEditText"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_gravity="top"
                    android:drawingCacheQuality="auto"
                    android:gravity="top"
                    android:inputType="textAutoCorrect|textMultiLine|text|textAutoComplete"
                    android:minLines="3"
                    android:singleLine="false"
                    android:textSize="14sp" />
</com.google.android.material.textfield.TextInputLayout>

更新到最新的库后,TextInputLayout中我的EditText的此android:gravity="top"代码不起作用。

而且这不是发生这种情况的唯一地方。我是否应该更新库?有人可以帮我这个决定吗?通过不更新库,我的应用程序将无法正常运行吗?

对不起,麻烦。

android xml layout android-library
1个回答
0
投票

您能否通过添加样式密集的属性来尝试。将此样式应用于您的TextInputLayout。

style =“ @ style / Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense”

Refer to this link

© www.soinside.com 2019 - 2024. All rights reserved.