首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AppCompat等价于"Theme.Wallpaper.NoTitleBar.Fullscreen“

AppCompat等价于"Theme.Wallpaper.NoTitleBar.Fullscreen“
EN

Stack Overflow用户
提问于 2016-05-23 12:06:00
回答 1查看 1.7K关注 0票数 0

我正在创建一个定制的启动程序,并找到了这个伟大的教程

只要我把我的活动扩展到活动中,一切都会很好。我想使用AppCompatActivity扩展我的活动,但是在这样做时,我得到了以下错误:

您需要在此活动中使用Theme.AppCompat主题(或后代)。

所以我决定写我自己的风格:

代码语言:javascript
复制
<!-- 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>

这似乎是可行的,但是我的背景不再设置在手机的壁纸上。取而代之的是白色。

我想要的:

我得到的是:

我很感激所有可能解决我的问题的技巧和提示,或者让我走上解决问题的正确道路。提前谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-05-23 12:24:01

试试这个:

在onCreate()中:

代码语言:javascript
复制
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。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37390587

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档