Yes, I have the same problem, but I have a solution, and it worked for me.
I added Textview at runtime, and also get them click below - this is the code.
for (int i = 0; i < albumItemList.size(); i++) { toplayout = getActivity().getLayoutInflater().inflate(R.layout.addphotoalbumlistinfater, null); newTV = (TextView)toplayout.findViewById(R.id.textView) ; textViewcount= (TextView)toplayout.findViewById(R.id.textViewcount) ; ll = (RelativeLayout) toplayout.findViewById(R.id.mainitemlist) ; ll.setTag("position"+i); newTV.setText(albumItemList.get(i).getAlbumName()); textViewcount.setText(""+albumItemList.get(i).getCount()); ll.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Toast.makeText(getActivity(),""+v.getTag(),Toast.LENGTH_SHORT).show(); } }); linearLayoutforaddchild.addView(toplayout); }
Vinod makode
source share