开发者

How to adjust textview width dynamically in a tablerow

开发者 https://www.devze.com 2023-04-12 09:40 出处:网络
i have a simple tablelayout each table row has the following components image view1 | Text view | Image view2 |Image View2

i have a simple tablelayout each table row has the following components

image view1 | Text view | Image view2 |Image View2

The text view data is provided from the databas开发者_JAVA技巧e.

how to set widthof(textview) = widthof(screen)-[(widthof(imageview1)+widthof(imageview2)+widthof(imageview3)]


Try this to get the width

int width = getWindowManager().getDefaultDisplay().getWidth() - (imageview2.getWidth() + 
        imageview3.getWidth());
ViewGroup.LayoutParams vp = new ViewGroup.LayoutParams(width,LayoutParams.WRAP_CONTENT);
textview.setLayoutParams(vp);
0

精彩评论

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

关注公众号