围绕在Android的背景图像 [英] Centering a background image in Android

查看:130
本文介绍了围绕在Android的背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有大约100×100,我想在一个Android应用程序为中心的背景图像。有没有办法做到这一点?

I have a background image about 100 x 100 that I want to center in an Android app. Is there a way to do this?

我想这将大大有简单的应用方向的变化有所帮助。

I'm thinking it would greatly help with orientation changes for simple apps.

推荐答案

您可以使用BitmapDrawable的情况。创建centered.xml在 RES /绘制文件夹:

You can use BitmapDrawable for the case. Create centered.xml in res/drawable folder:

<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/your_image"
    android:gravity="center"/>

然后你可以用中心绘制作为背景。

这篇关于围绕在Android的背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆