Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Well thanks for the link but i found the solution :-</p> <p>One can always use custom widgets and its not that scary also :) In my case i used to custom scroll views and in xml mentioned their packagename+className</p> <p>For ex :</p> <pre><code>&lt;org.vision_asia.utils.MyScrollView1 android:id="@+id/sv1" android:layout_below="@id/channel_img_header" android:layout_height="fill_parent" android:layout_width="wrap_content" android:scrollbars="none"&gt; &lt;LinearLayout android:background="@color/White" android:id="@+id/layout_to_add_channel_image" android:layout_alignParentBottom="true" android:layout_below="@id/channel_img_header" android:layout_height="wrap_content" android:layout_width="wrap_content" android:orientation="vertical" /&gt; </code></pre> <p></p> <p>and you want to synchronize this ScrollView with other scroll view such that if user scrolls this scroll view then simultaneously the other scroll view must get scrolled as if all the elements are under one scroll view only</p> <pre><code>public class MyScrollView1 extends ScrollView { public MyScrollView2 sv2; public MyScrollView1(Context context) { super(context); // TODO Auto-generated constructor stub } public MyScrollView1(Context context, AttributeSet attrs) { super(context, attrs); // TODO Auto-generated constructor stub } @Override protected void onScrollChanged(int l, int t, int oldl, int oldt) { // TODO Auto-generated method stub sv2.scrollTo(oldt, t); super.onScrollChanged(l, t, oldl, oldt); } } </code></pre> <p>and in your main activity you must call the custom scroll view like this :-</p> <pre><code>sv1 = (MyScrollView1)channelsList.findViewById(R.id.sv1); sv1.sv2 = sv2; </code></pre> <p>where sv2 is the scrollview which should be synchronized </p> <p>For complete synchronization you will need 2 custom scroll views </p> <p>Enjoy</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