Android : can't find my inflated view in pager

on Friday, September 5, 2014


I have some specific pager called JazzyViewPager, which is a classic ViewPager with some effects.


In my pager adapter method instantiateItem(), @param(ViewGroup container,final int position), I put



int pic = R.drawable.ic_launcher;
ImageView img = new ImageView(getActivity());
img.setBackgroundResource(pic);
container.addView(img,
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
LayoutInflater inflater_pager =
(LayoutInflater) container.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View vi = inflater_pager.inflate(R.layout.tag_list, null);
container.addView(vi,0);


where the tag_list layout corresponds to



<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="Nikita Hrist"
/>
</LinearLayout>


Now I can see the picture I set as a background but I can't find the text. How can I deal with that ?


0 comments:

Post a Comment