-
Notifications
You must be signed in to change notification settings - Fork 451
/
Copy pathAutoScrollActivity.java
51 lines (45 loc) · 1.89 KB
/
AutoScrollActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.nightonke.wowoviewpagerexample;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RelativeLayout;
public class AutoScrollActivity extends GuidePageActivity1 {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RelativeLayout base = (RelativeLayout) findViewById(R.id.base);
Button startButton = new Button(this);
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(0, 0, 0, 80);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
startButton.setLayoutParams(layoutParams);
startButton.setText("Start Auto Scroll");
startButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
wowo.startAutoScroll(false, 2000, 2000);
}
});
base.addView(startButton);
Button stopButton = new Button(this);
layoutParams = new RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.setMargins(0, 0, 0, 0);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
stopButton.setLayoutParams(layoutParams);
stopButton.setText("Stop Auto Scroll");
stopButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
wowo.stopAutoScroll();
}
});
base.addView(stopButton);
}
}