开发者

How to adjust textview width dynamically in a tablerow

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜