固定背景在切换布局时。

huangapple go评论66阅读模式
英文:

Fixed background while switching layouts

问题

我已上传我的应用程序,我发现尽管所有我的布局都有相同的背景图像,但当我切换布局时,布局会根据动画移动。

有没有办法让我为所有的布局设置一个固定的背景?

在切换到下一个布局之前,我在每个布局上都使用了 finish();,这有关系吗?

将相同的背景设置给所有布局并不会使它固定(它会移动)。

创建一个类似以下样式也不起作用:

<style name="AppTheme.FullBackground" parent="AppTheme">
    <item name="android:background">@mipmap/background</item>
</style>

然后在清单文件中添加:

android:theme="@style/AppTheme.FullBackground"

有什么建议吗?

英文:

I got my application uploaded and I see that despite I have the same background image on all my layouts.

if I switch, the layout moves according to the animation.

Is there a way for me to set a fixed background for all my layouts?

Does it matter that I finish(); every layout before I switch to the next one?

Setting the same background to all the layouts doesn't make it fixed (it moves)

neither does creating a style like :

&lt;style name=&quot;AppTheme.FullBackground&quot; parent=&quot;AppTheme&quot;&gt;
    &lt;item name=&quot;android:background&quot;&gt;@mipmap/background&lt;/item&gt;
&lt;/style&gt;

and adding :

android:theme=&quot;@style/AppTheme.FullBackground&quot;

to the manifest.

Any ideas?

答案1

得分: 0

如果您的应用程序中使用了所有的活动,请将所有的活动更改为片段(Fragment),并只使用一个带有所需图像作为背景的活动。

然后在您的应用程序中的所有片段中都只使用这个活动。这样在导航到不同屏幕(片段)时不会移动您的背景图像。

英文:

If you are using all activities in your app then change all activities to fragment and just use one activity with your required image as background.

Then use just this activity for all the fragments in your app. This will not move your background image during navigating to different screens(fragments)

huangapple
  • 本文由 发表于 2020年9月10日 17:22:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/63826661.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定