9补丁图像,其中中心为1:1补丁、图像、中心

2023-09-04 08:59:56 作者:寡妇村村长

我想在中间建立在Android闪屏的小标志, 但标志streched的大型设备。我以为我可以使用9片图像,但它似乎是一个9片图像作品倒什么,我试图达成。

I want to create a splash screen on Android with a small logo in the middle, but the logo is streched on larger devices. I thought I could use a 9 patch image, but it seems a 9 patch image works inversed to what I try to reach.

这是具有要在中间的标志

This is the logo that has to be in the middle.

这是我所得到的,当我设置图片为9补丁。 该中心伸出和拐角都完好无损。 我需要相反的。 我需要一个9补丁可以定义始终显示在正确1的中心区域:1的比例,并在左侧边,右侧,顶部和底部可如果图像是小于屏幕拉伸

This is what I get when I set the image as a 9 patch. The center is stretched out and the corners are intact. I need to opposite. I need a 9 patch that can define a center area that is always displayed in correct 1:1 proportion, and border areas at left, right, top and bottom that can be stretched if the image is smaller than the screen.

我怎样才能做到这一点?带或不带9的补丁。

How can I do this? With or without 9 patch.

推荐答案

下面是你如何能做到这样的一个例子。这是一个9patch,所以保存它是这样的:yourname.9.png不要忘记设置机器人:您 ImageView的

Here is an example of how you can do this. This is a 9patch, so save it like this: yourname.9.png and don't forget to set android:scaleType="fitXY" on your ImageView