我有一TableLayout对夫妇TextViews。我想找到的layout_weight,TextView但我不知道如何。我尝试了以下方法:
TableRow.LayoutParams lp = tv1.getLayoutParams();
和:
ViewGroup.LayoutParams lp = tv1.getLayoutParams();
在第一种情况下,我得到类型不匹配:“无法从 ViewGroup.LayoutParams 转换为 TableRow.LayoutParams”,第二种情况工作正常,但ViewGroup.LayoutParams没有weight字段。
所有不同类型的LayoutParams都令人困惑,我永远不确定在哪里使用哪个。