怎么遍历view中的所有的控件
1个回答
展开全部
public class Main extends Activity
{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
LinearLayout loginLayout = (LinearLayout) getLayoutInflater().inflate(R.layout.main, null);
String pa="";//遍历所有控件
for (int i = 0; i < loginLayout.getChildCount(); i++)
{
View v=loginLayout.getChildAt(i);
//如何判断是Button或者是TextBox
if(){
Object v = tabWidget.getChildAt(i);
if (v instanceof RelativeLayout)
{
}
}
}
}
{
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
LinearLayout loginLayout = (LinearLayout) getLayoutInflater().inflate(R.layout.main, null);
String pa="";//遍历所有控件
for (int i = 0; i < loginLayout.getChildCount(); i++)
{
View v=loginLayout.getChildAt(i);
//如何判断是Button或者是TextBox
if(){
Object v = tabWidget.getChildAt(i);
if (v instanceof RelativeLayout)
{
}
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询