80,351
社区成员
发帖
与我相关
我的任务
分享
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.testhead);
initRelativeLayout();
}
private void initRelativeLayout()
{
LayoutInflater layout = LayoutInflater.from(this);
View view = layout.inflate(R.layout.frame_setting, null);
// this.addContentView(view, null);
RelativeLayout shakeLayout=(RelativeLayout)view.findViewById(R.id.vibrate_notify);
TextView txtView=(TextView)view.findViewById(R.id.shake_title);
txtView.setText("不想说太多");
}
在一个布局里,好像也改变不了另外一个layout里的控件的属性,另外显示怎么追当加当前布局? LayoutInflater layout = LayoutInflater.from(this);
View view = layout.inflate(R.layout.frame_setting, null);
我已经得出我的view,如何循环得到view里的RelativeLayout
谢谢LayoutInflater layout = LayoutInflater.from(this);
LinearLayout parentView = layout.inflate(R.layout.frame_setting, null);
for (int i=0; parentView.getChildCount(); ++i) {
//这里的childView就是楼主所需的一个个的RelativeLayout
View childView = view.getChildAt(i);
}