Methods Summary |
---|
protected android.widget.ScrollView | createScrollView()Hook for changing how scroll view's are created.
return new ScrollView(this);
|
public T | getContentChildAt(int index)Get the child contained within the vertical linear layout of the
scroll view.
return (T) mLinearLayout.getChildAt(index);
|
public android.widget.LinearLayout | getLinearLayout()
return mLinearLayout;
|
public android.widget.ScrollView | getScrollView()
return mScrollView;
|
protected abstract void | init(com.android.frameworktest.util.ScrollViewScenario$Params params)Override this and initialized the views in the scroll view.
|
protected void | onCreate(android.os.Bundle savedInstanceState)
super.onCreate(savedInstanceState);
// for test stability, turn off title bar
requestWindowFeature(Window.FEATURE_NO_TITLE);
int screenHeight = getWindowManager().getDefaultDisplay().getHeight()
- 25;
mLinearLayout = new LinearLayout(this);
mLinearLayout.setOrientation(LinearLayout.VERTICAL);
// initialize params
final Params params = new Params();
init(params);
// create views specified by params
for (ViewFactory viewFactory : params.mViewFactories) {
final LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
(int) (viewFactory.getHeightRatio() * screenHeight));
mLinearLayout.addView(viewFactory.create(this), lp);
}
mScrollView = createScrollView();
mScrollView.addView(mLinearLayout, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT));
// no animation to speed up tests
mScrollView.setSmoothScrollingEnabled(false);
setContentView(mScrollView);
|