문제

Good evening,

I'm using Eclipse with the UI-Framework Codename One.

I would like to know how it would be possible to scale an image to fit the width of the screen? I would like to create a list with one image( or even an imageslider if this is possible), which has the full width of the phone, and under that some text.

Another question is, how can I set an Image via Hastable and Vector from code ? I tried everything but I can't find a solution.

Thank you a lot,

Greetings Patric

도움이 되었습니까?

해결책

It depends on what you are trying to do.

Normally you would just set the image as the background image of the component and select the background behavior as SCALE_TO_FIT which can be done both via the theme designer and via the Style object of the component.

You can also use the ImageViewer class if you want to have a viewable/zoomable image.

You can also just scale the image to the size you want using either the scaled() method or ImageIO.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top