Saturday, November 16, 2013

[android-developers] onscrollchanged in horizontal scroll view

Hi there,
i need to implement onscrollchanged method in my class so that when scroll is changing i will update seek bar position as per scroll value.

i implemented a customhorizontalview class with extends HorizontalScrollView.

also created customhorizontalview in xml . but my problem is that how to override onscrollchange method in my class so that as scroll is changing i could update seek bar corresponding to horizontal scroll.

here is my customhorizontalview class

import android.content.Context;

import android.util.AttributeSet;

import android.util.Log;

import android.widget.HorizontalScrollView;




public class CustomHorizontalScroll extends HorizontalScrollView  {


   

    public interface onScrollChangedListener{

        public abstract void onScrollChanged(int l, int t, int oldl, int oldt);

    }

   

    onScrollChangedListener mMyScrollViewListener


    public void setMyScrollViewListener(onScrollChangedListener listener ){

        mMyScrollViewListener = listener;

    }

   

    @Override

    protected void onScrollChanged(int l, int t, int oldl, int oldt) {

        super.onScrollChanged(l, t, oldl, oldt);

        Log.v("Positions",l+","+t) ;

    }


    public CustomHorizontalScroll(Context context, AttributeSet attrs) {

        super(context, attrs);

        // TODO Auto-generated constructor stub

       

    }


}



i am using this in my java file 

hs_scroll_view = (CustomHorizontalScroll) findViewById(R.id.id_hs_scroll_view) ;


i want to override onscrollchanged in my java file so that i could update seek bar as per scroll but i don't know how to do that .


please suggest me any idea ?


thanks 

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate