80,351
社区成员
发帖
与我相关
我的任务
分享
<linearLayout>
<linearLayout>
<textview >title</textview >
<textview >content</textview >
</linearLayout>
<linearLayout>
<textview >title</textview >
<textview >content</textview >
</linearLayout>
<linearLayout>
<textview >title</textview >
<textview >content</textview >
</linearLayout>
...
...
</linearLayout>
public void method( ){
// 添加多个
foreach( .. : .. ) {
....
textView.setId(R.id.content);
linearlayout.addView(textView, -1);
}
linearlayout.setOnClickLister( new OnClickListener() {
public void onClick( Event event ) {
// ...
findviewById( content ).setVisibility( View.INVISIBLE );
}
}
}
也是种好办法。就是会改变 xml 的结构相当于。 [quote=引用 4 楼 KF_G 的回复:] 控件都在一起的话,就一起放进一个Linearlayout里,对Linearlayout进行显示隐藏
也是种好办法。就是会改变 xml 的结构相当于。 控件都在一起的话,就一起放进一个Linearlayout里,对Linearlayout进行显示隐藏
控件都在一起的话,就一起放进一个Linearlayout里,对Linearlayout进行显示隐藏
用递归遍历组件,找到类型是textview,文字是指定内容的