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

更新Android库是否会导致我的代码出错?,android,xml,layout,android-library,Android,Xml,Layout,Android Library,我在用 实现组:“com.google.android.material”,名称:“material”,版本:“1.1.0-alpha05” 库来渲染材质组件,但随后我将库更新为 实现组:“com.google.android.material”,名称:“material”,版本:“1.2.0-alpha03” 一切坏事都发生了。我困惑了一个小时,问自己哪里做错了 这是我不得不经历的错误: 更新前: 更新后: 是我的代码有问题还是更新库的错 以下是XML中的代码: <com.googl

我在用
实现组:“com.google.android.material”,名称:“material”,版本:“1.1.0-alpha05”
库来渲染材质组件,但随后我将库更新为
实现组:“com.google.android.material”,名称:“material”,版本:“1.2.0-alpha03”
一切坏事都发生了。我困惑了一个小时,问自己哪里做错了

这是我不得不经历的错误:

更新前:

更新后:

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

以下是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中的my EditText的这个
android:gravity=“top”
代码不起作用

而且这不是唯一发生这种情况的地方。我是否应该更新库?有人能帮我做这个决定吗?如果不更新库,我的应用程序会不能正常工作吗


很抱歉给您添麻烦。

您可以尝试在样式中添加稠密属性吗。 将此样式应用于TextInputLayout

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


请尝试在样式中添加稠密属性。 将此样式应用于TextInputLayout

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


我无法在29 Api中获得框,但框中包含了之前几乎所有的Api。另外,代码
android:gravity=“top”
不起作用。这个问题是在我将库更新为1.2.0-alpha03之后发生的。确定框在那里,但是代码
android:gravity=“top”
不起作用。您是否尝试使用填充代替重力?我尝试过使用填充,但填充在不同的设备上会给我不同的结果。我已经向材料库开发人员报告了这一点。我希望他们能在下一次更新中解决这个问题。我无法在29 Api中找到这个框,但在它之前,几乎所有Api都有这个框。另外,代码
android:gravity=“top”
不起作用。这个问题是在我将库更新为1.2.0-alpha03之后发生的。确定框在那里,但是代码
android:gravity=“top”
不起作用。您是否尝试使用填充代替重力?我尝试过使用填充,但填充在不同的设备上会给我不同的结果。我已经向材料库开发人员报告了这一点。我希望他们能在下一次更新中解决这个问题。嗨!你解决了这个问题吗?我恢复到以前版本的Material LibraryHi!你解决了这个问题吗?我恢复到了以前版本的材质库