[英]How to adjust textview width dynamically in a tablerow
我有一个简单的表布局,每个表行都有以下组件
图片检视1 | 文字检视| 图片检视2 |图片检视2
文本视图数据是从数据库中提供的。
如何设置widthof(textview)= widthof(屏幕)-[(widthof(imageview1)+ widthof(imageview2)+ widthof(imageview3)]
试试这个来获得宽度
int width = getWindowManager().getDefaultDisplay().getWidth() - (imageview2.getWidth() +
imageview3.getWidth());
ViewGroup.LayoutParams vp = new ViewGroup.LayoutParams(width,LayoutParams.WRAP_CONTENT);
textview.setLayoutParams(vp);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.