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);
精彩评论