当前位置: 代码迷 >> 综合 >> android 跳转时出现短暂的黑屏继承AppCompatActivity问题
  详细解决方案

android 跳转时出现短暂的黑屏继承AppCompatActivity问题

热度:91   发布时间:2023-10-19 07:49:52.0
第一步:xxx/res/values/styles.xml中加入自定义Activity的Theme,如下所示:
<style name="Transparent" parent="android:Theme.Light"><!--将Activity的Theme设置成透明--><item name="android:windowIsTranslucent">true</item></style>
<activityandroid:name=".activities.GoodsListActivity"android:screenOrientation="portrait"android:theme="@style/Transparent"/>

再报这个错之前应该会报另一个错误。

运行发现汇报错误:

You need to use a Theme.AppCompat theme (or descendant) with this activity.

你需要使用Theme.AppCompat theme

只需修改一下style

<style name="Transparent" parent="Theme.AppCompat.Light.NoActionBar"><!--将Activity的Theme设置成透明--><item name="android:windowIsTranslucent">true</item></style>
ok了;
  相关解决方案