2011-10-11 67 views
0

我有一個簡單的tablelayout每個表格行都有以下組件如何在tablerow中動態調整textview的寬度

image view1 |文字視圖| Image view2 | Image View2

文本視圖數據是從數據庫提供的。

如何設置widthof(的TextView)= widthof(畫面) - [(widthof(imageview1)+ widthof(imageview2)+ widthof(imageview3)]

回答

0

嘗試使用此方法獲得的寬度

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