Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <com.example.random.ScrollViewExt
- android:id="@+id/scrollview1"
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent">
- <LinearLayout android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:paddingBottom="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin" >
- <TextView
- android:id="@+id/text1"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/hello_world" />
- </LinearLayout>
- </com.example.random.ScrollViewExt>
- package com.example.random;
- import android.widget.ScrollView;
- import android.content.Context;
- import android.util.AttributeSet;
- public class ScrollViewExt extends ScrollView {
- private ScrollViewListener scrollViewListener = null;
- public ScrollViewExt(Context context) {
- super(context);
- }
- public ScrollViewExt(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
- public ScrollViewExt(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
- public void setScrollViewListener(ScrollViewListener scrollViewListener) {
- this.scrollViewListener = scrollViewListener;
- }
- @Override
- protected void onScrollChanged(int l, int t, int oldl, int oldt) {
- super.onScrollChanged(l, t, oldl, oldt);
- if (scrollViewListener != null) {
- scrollViewListener.onScrollChanged(this, l, t, oldl, oldt);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement