横向模式下URLImage的占位符缩放问题 [英] Placeholder scaling issue with URLImage in landscape mode

查看:34
本文介绍了横向模式下URLImage的占位符缩放问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将占位符缩放到屏幕尺寸,如下所示.但是,如果是第一次以人像模式观看,则仅会占用屏幕,而不能以风景模式覆盖整个屏幕.如果是在横向模式下第一次观看,则它看起来大于纵向模式下的屏幕尺寸.

I scaled the placeholder to the screen size as below. But if it is first viewed in portrait mode, it just takes the screen and doesn't cover whole screen in landscape mode. If it is 1st viewed in landscape mode, then it appears bigger than the screen size in portrait mode.

如何解决此问题.我签入了 PropertyCross 演示,那里也存在相同的问题.

How do I fix this problem. I checked in PropertyCross demo and the same issue exists there too.

private EncodedImage largePlaceholder;

protected void initVars(Resources res) {
    Image tmp = Image.createImage(Display.getInstance().getDisplayWidth(), Display.getInstance().getDisplayWidth() / 6 * 3, 0);
    largePlaceholder = EncodedImage.createFromImage(tmp, false);
}

findMainImg(f).setIcon(URLImage.createToStorage(largePlaceholder, getMainImg + "_0_ y", getMainImg, URLImage.RESIZE_SCALE_TO_FILL));

已更新:

int sizethumb = 0;
int sizethumb1 = 0;
if (responsesImg.size() > 0) {

    sizethumb = largePlaceholder.getWidth();
    sizethumb1 = largePlaceholder.getHeight();
    findMainImg().setPreferredSize(new Dimension(sizethumb, sizethumb1));

    findMainImg(f).getAllStyles().setBgImage(URLImage.createToStorage(largePlaceholder, newsImgFilename + "_0_ y", responsesImg.get(0).get("image_url"), URLImage.RESIZE_SCALE));

    mainImageImgViewer = findMainImg(f).getAllStyles().getBgImage();
    System.out.println("beck0 " + mainImageImgViewer); //it gives null 

推荐答案

我建议将其设置为样式的bg图片,并将背景行为设置为 SCALE_TO_FILL SCALE_TO_FIT .

I suggest setting it as the bg image of the style and setting the background behavior to SCALE_TO_FILL or SCALE_TO_FIT.

这篇关于横向模式下URLImage的占位符缩放问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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