开发者

change image size wih jquery

I have a image under div id myimage. Now I want to resize it by using change. I want from select box if selected 700开发者_如何学PythonX7000 then image's size will be height 700px and width 700px. With out reloading the page. Can any one help me how can I do this?


Set new new LayoutParams(200, 200) everytime.

screenDensity = getResources().getDisplayMetrics().density;
dimInDP = 200 * (screenDensity/(float)160)
imageTextView.setLayoutParams(new LinearLayout.LayoutParams(dimInDP ,dimInDP ));

EDIT : The Android system takes 160dpi as the reference density for density independent pixel calculation. For example, in your case you need dimension as 200dp. The system takes this as the numbersof pixels you want on a device of screen density 160dpi. So at runtime it scales the width relative to the reference density.

Assume you run ur app on a screen density 120. The view width will be scaled to 150 physical pixels.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜