对布局对象及其子控件进行操作

来源:互联网 发布:卢武铉在韩国名声知乎 编辑:程序博客网 时间:2024/05/21 02:50
protected LinearLayout mTabsHolder=null;View viewLikeBtn=null;mTabsHolder=(LinearLayout)findViewById(R.id.tabs_holder);int count=mTabsHolder.getChildCount();//得到布局控件中子控件的数量mTabsHolder.removeViews(0,count);//从位置0开始移除count个子控件mTabsHolder.addView(viewLikeBtn);//向布局中添加视图控件TextView homeBtn=(TextView)mTabsHolder.getChildAt(0);//获取位置0 的控件

0 0
原创粉丝点击