Android 遍历界面控件

    	//遍历界面上的控件 fubin.pan
    	LinearLayout sLinerLayout = (LinearLayout)findViewById(R.id.layout_scr);
    	for (int i = 0; i < sLinerLayout.getChildCount(); i++) {
    		View v=sLinerLayout.getChildAt(i);
    		if ( v instanceof RadioGroup){
    			RadioGroup mRadioGroup = (RadioGroup)sLinerLayout.getChildAt(i);
    			//根据ID获取RadioButton的实例                 
    			RadioButton rb = (RadioButton)questionitemlist2.this.findViewById(mRadioGroup.getCheckedRadioButtonId());
    			if (rb.getTag(R.id.tag_toend).toString().equals(""))//判断ToEnd监听
    			{
    				
    			}else if(rb.getTag(R.id.tag_tonext).toString().equals(""))//判断ToNext监听
    			{
    				
    			}
    		}

    	}

你可能感兴趣的:(android,遍历界面控件)