我有查看。如何在View中获取和编辑子项。
View myTable = inflater.inflate(R.layout.letters_table, container);
// Get and edit myTable children
答案 0 :(得分:1)
并非所有View
都有孩子。只有ViewGroup
个实例。如果你想让孩子膨胀View
试试这个:
if (view instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) view;
for(int i = 0; i< viewGroup.getChildCount(); ++i) {
View child = viewGroup.getChildAt(i);
// Edit the child
}
}