以编程方式获取/设置android小部件图像视图大小 [英] get/set android widget image view size programmatically

查看:104
本文介绍了以编程方式获取/设置android小部件图像视图大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。我有一个小部件。并在其中的图像视图;我想以编程方式获取/设置ImageView的大小;并为其他视图执行此操作,例如relativeLayout和.....我怎么能这样做?

谢谢

Hi.I have a widget. and an image view in that; I want to get/set size of the ImageView programmatically; And do this for other view like relativeLayout and ..... How Can I do this ?
Thanks

推荐答案

输入此代码在主要活动中



Just Type This Code in main activity

image_view.getLayoutParams().width = 20;
image_view.getLayoutParams().height = 20;





我认为这样可以解决您的问题。



I thought this will solve your problem.


image_view.getLayoutParams().width = 20;
image_view.getLayoutParams().height = 20;


这篇关于以编程方式获取/设置android小部件图像视图大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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