android - Android assemble build 搞砸了 GUI
问题描述
我有以下片段接口:
从 Android Studio 运行应用程序时显示良好。但是,当我使用 assemble(例如 assembleDebug)运行构建时,界面会像这样混乱:
这是片段的布局 XML:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="viewmodel"
type="com.blablabla.presentation.vehicleinspection.viewmodel.VehicleCheckDamagesBottomSheetViewmodel" />
</data>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorWhite"
android:orientation="vertical"
android:paddingBottom="@dimen/space_large">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorAccent"
android:padding="@dimen/space_small">
<TextView
style="@style/TextMedium.Light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/space_special"
android:text="@{viewmodel.title}"
tools:text="@tools:sample/lorem" />
</FrameLayout>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/space_normal"
app:adapter="@{viewmodel.adapter}"
app:layoutManager="android.support.v7.widget.GridLayoutManager"
app:spanCount="2"
app:useDefaultMargins="true" />
</LinearLayout>
</layout>
解决方案
检查您的 app/src/debug 文件夹,当您组装特定的构建变体时,它将首先检查该变体的资产。
与 app/src/main 中的内容相比,您可能有不同的 res/values/dimens.xml 文件和值