Android 切换到“材质设计”组件时,“活动布局”变为空白
问题: 应用程序使用时没有问题 Theme.MaterialComponents.Light.NoActionBar 但在布局中没有使用任何MDC元素,如(TextInputLayout等) 然后我用Android 切换到“材质设计”组件时,“活动布局”变为空白,android,material-design,mdc-components,Android,Material Design,Mdc Components,问题: 应用程序使用时没有问题 Theme.MaterialComponents.Light.NoActionBar 但在布局中没有使用任何MDC元素,如(TextInputLayout等) 然后我用TextInputLayout替换了Editext,用Material按钮替换了按钮 现在问题来了 当我运行我的应用程序时,我看到屏幕变成空白。纯白色 我查过了。 我发现有7个警告和2个错误(渲染问题) 渲染问题如下所示- 不支持Path.op()。(正如它所暗示的那样,我多次刷新了布局。不起作用)
TextInputLayout
替换了Editext
,用Material按钮替换了按钮
现在问题来了
当我运行我的应用程序时,我看到屏幕变成空白。纯白色
我查过了。
我发现有7个警告和2个错误(渲染问题)
渲染问题如下所示-
谢谢。我建议您首先使用桥接,然后根据需求设计逐步覆盖父主题属性 在AndroidManifest.xml中
android:theme="@style/MyMaterialTheme"
然后在style.xml下。它会像
<style name="MyMaterialTheme" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimary</item>
<item name="android:windowBackground">@color/white</item>
<item name="toolbarStyle">@style/BlueToolbar</item>
</style>
假的
真的
@颜色/原色
@颜色/原色暗
@颜色/原色
@颜色/白色
@样式/蓝色工具栏
试着转介
简单的解决办法是让你的主题延伸成一个桥梁主题:)我希望这能有所帮助