Created
November 22, 2018 07:58
-
-
Save AB1209/a7168232caee881a8faf6abd917833a2 to your computer and use it in GitHub Desktop.
ScrollTest activity, impleming ScrollViewListenere
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ScrollTest extends Activity implements ScrollViewListener { | |
private ObservableScrollView scroll_vertical_from_both; | |
private ObservableScrollView scroll_vertical_only; | |
private ObservableHorizontalScrollView scroll_horizontal_from_both; | |
private ObservableHorizontalScrollView scroll_horizontal_only; | |
/** | |
* Called when the activity is first created. | |
*/ | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.scrolltest); | |
scroll_vertical_from_both = (ObservableScrollView) findViewById(R.id.scroll_vertical_from_both); | |
scroll_vertical_only = (ObservableScrollView) findViewById(R.id.scroll_vertical_only); | |
scroll_horizontal_from_both = (ObservableHorizontalScrollView) findViewById(R.id.scroll_horizontal_from_both); | |
scroll_horizontal_only = (ObservableHorizontalScrollView) findViewById(R.id.scroll_horizontal_only); | |
scroll_vertical_from_both.setScrollViewListener(this); | |
scroll_vertical_only.setScrollViewListener(this); | |
scroll_horizontal_from_both.setScrollViewListener(this); | |
scroll_horizontal_only.setScrollViewListener(this); | |
} | |
@Override | |
public void onScrollChanged(ObservableScrollView scrollView, int x, int y, int oldx, int oldy) { | |
Log.i("", "VERTICAL"); | |
scroll_vertical_from_both.scrollTo(x, y); | |
scroll_vertical_only.scrollTo(x, y); | |
} | |
@Override | |
public void onScrollChanged(ObservableHorizontalScrollView scrollView, int x, int y, int oldx, int oldy) { | |
Log.i("", "HORIZONTAL"); | |
scroll_horizontal_from_both.scrollTo(x, y); | |
scroll_horizontal_only.scrollTo(x, y); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment