我正在创建一个定制的启动程序,并找到了这个伟大的教程
只要我把我的活动扩展到活动中,一切都会很好。我想使用AppCompatActivity扩展我的活动,但是在这样做时,我得到了以下错误:
您需要在此活动中使用Theme.AppCompat主题(或后代)。
所以我决定写我自己的风格:
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/AppTheme">
<item name="windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
</style>这似乎是可行的,但是我的背景不再设置在手机的壁纸上。取而代之的是白色。
我想要的:

我得到的是:

我很感激所有可能解决我的问题的技巧和提示,或者让我走上解决问题的正确道路。提前谢谢。
发布于 2016-05-23 12:24:01
试试这个:
在onCreate()中:
WallpaperManager wallpaperManager = WallpaperManager.getInstance(this);
Drawable wallpaperDrawable = wallpaperManager.getDrawable();
RelativeLayout ll = (RelativeLayout) findViewById(R.id.main);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
ll.setBackground(wallpaperDrawable);
}其中main是您活动的根布局的id。
https://stackoverflow.com/questions/37390587
复制相似问题