Str*_*boy 3 java android android-layout
我想将相同的背景图像设置为我的所有应用布局.我的应用支持从迷你手机到10.1平板电脑的所有设备.
有没有一种方法可以做到这一点,或者我需要设置每个布局重新调整尺寸的图像,质量会很好.
我在一个应用程序中找到了这个:drawable文件夹中的app_background.xml:
<?xml version="1.0" encoding="utf-8"?>
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffff00" />
</shape>
Run Code Online (Sandbox Code Playgroud)
也许有人可以给我很好的解释如何在java中分离设计和功能.
谢谢.
Ale*_*sny 13
使用样式执行此操作.
1.为背景创建适当的可绘制图像
2.使用以下内容创建values/styles.xml文件
<style name="AppTheme" parent="android:style/Theme.Black">
<item name="android:background">@drawable/main_app_bg</item>
</style>
Run Code Online (Sandbox Code Playgroud)
3.在AndroidManifest.xml中为整个应用程序使用主题
Run Code Online (Sandbox Code Playgroud)<application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@style/AppTheme">
| 归档时间: |
|
| 查看次数: |
20350 次 |
| 最近记录: |