删除LinearLayout

时间:2017-01-06 11:16:16

标签: android view onclick android-linearlayout

我在LinearLayout中添加了视图,但我使用了多个小部件,比如

CardView cvItem[] = new CardView[fList.size()]; 
TextView tvItem[] = new TextView[fList.size()];

LayoutInflater layoutInflater = (LayoutInflater) context
                                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

 ItemView = layoutInflater.inflate(
                                R.layout.dashboard_item, null);

cvItem[i] = (CardView) ItemView.findViewById(R.id.cvboardItem);
ivItem[i] = (ImageView) ItemView.findViewById(R.id.ivboardItem);
tvItem[i] = (TextView) ItemView.findViewById(R.id.tvboardItem);


if (ItemView.getParent() != null)
((ViewGroup) ItemView.getParent()).removeView(ItemView);
llExpandable.addView(ItemView);
  

我之所以使用它,是因为我希望获得特定位置的onClick,并且通过这种方式我得到了它。

cvItem[i].setOnClickListener(new View.OnClickListener() {
 @Override
           public void onClick(View v) {
                     //My Code...
            }
    });
  

请帮助我,我正在使用ScrollView,所以我无法使用ListView,我尝试了很多东西但没有对我有用

0 个答案:

没有答案