Android在代码中使用布局文件中的一个组件时间:2023-03-09 21:40:18 使用前必须要把组件与其父组件的关系断开,比如有一个组件的名称为scrollChildLayout,则可以使用下面的代码进行分离 ((ViewGroup)scrollChildLayout.getParent()).removeView(scrollChildLayout);view.addView(scrollChildLayout); 程序猿必读