我有 MainActivity 和 ListClassFile 。
MainActivity 具有来自 XML 的 Linearlayout(name is recordContent) 组件。(使用 findviewById 获取)。
在 ListClassFile 文件中,我调用 setListHandler 将返回 ListView 类。
现在,我在 MainActivity 中有两个按钮。当我单击 A 按钮时。
它会调用
private ListClassFile rdActivity = null;
private LinearLayout recordContent = null;
....
@Overrid
protected void onCreate(...){
...
recordContent = (LinearLayout) findViewById(R.id.recordContent);
...
if( rdActivity == null )
{
rdActivity = new ListClassFile();
recordContent.addView( rdActivity.setListHandler(MainActivity.this) );
// rdActivity.setListHandler(MainActivity.this) it will return listview
}
}
...
}
将listview
显示。
当我单击 B 按钮时。
我会打电话
if( rdActivity != null )
{
rdActivity = null;
recordContent.removeAllViews();
}
它将成功删除。
但我只想删除listview
. 并非记录内容中的所有视图。
如何指定删除 listview (rdActivity.setListHandler(MainActivity.this) )?
非常感谢你。