Note that there are some explanatory texts on larger screens.

plurals
  1. POSwipe View Pager Item on Button Click - Navigation
    text
    copied!<p>I have a list of view pager items, where in every row there are view pager items. I want to make the type of layout for a view pager item as shown in the image attached, where the user should be able to move the view pager using the arrow clicks too.</p> <p><img src="https://i.stack.imgur.com/YNrkH.png" alt="enter image description here"></p> <p>I am not able to get how to achieve the same, here is my code for the list adapter and pager adapter :</p> <p><strong>ListView GetView</strong></p> <pre><code> ViewHolder holder; if(rowView==null){ holder = new ViewHolder(); LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflater.inflate(R.layout.horizontal_list_item, parent, false); MyPagerAdapter adapter = new MyPagerAdapter(context); ViewPager myPager = (ViewPager) rowView.findViewById(R.id.mypager); myPager.setAdapter(adapter); myPager.setCurrentItem(4, true); rowView.setTag(holder); } else{ holder = (ViewHolder) rowView.getTag(); } </code></pre> <p><strong>PagerAdapter</strong></p> <pre><code> @Override public Object instantiateItem(View container, final int position) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); LinearLayout layout = (LinearLayout) inflater.inflate( R.layout.inner_layout_file, null); TextView tv_view = (TextView) layout.findViewById(R.id.text); tv_view.setText("Example Item " + position); ((ViewPager) container).addView(layout); }); return layout; </code></pre> <p>Pager Item Layout (inner_layout_file)</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/inner_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="horizontal" &gt; &lt;ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginRight="6.0dip" android:src="@drawable/ic_launcher" /&gt; &lt;TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="fill_parent" android:gravity="center_vertical" android:text="Example Value" android:textAppearance="?android:textAppearanceMedium" /&gt; &lt;/LinearLayout&gt; </code></pre> <p><strong>I am not able to get where to add the arrows and where to perform their on-clicks on runtime. I want to swipe the pager views using the arrows on the left and right</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload