1/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.widget.gridview;
18
19import android.graphics.drawable.PaintDrawable;
20import android.os.Bundle;
21import android.view.View;
22import android.view.ViewGroup;
23import android.widget.TextView;
24
25import android.util.GridScenario;
26
27public class GridSimple extends GridScenario {
28    @Override
29    protected void init(Params params) {
30        params.setStackFromBottom(false)
31                .setStartingSelectionPosition(-1)
32                .setNumItems(1000)
33                .setNumColumns(3)
34                .setItemScreenSizeFactor(0.14);
35    }
36
37    @Override
38    protected void onCreate(Bundle icicle) {
39        super.onCreate(icicle);
40
41        getGridView().setSelector(new PaintDrawable(0xFFFF0000));
42        getGridView().setPadding(0, 0, 0, 0);
43        getGridView().setFadingEdgeLength(64);
44        getGridView().setVerticalFadingEdgeEnabled(true);
45        getGridView().setBackgroundColor(0xFFC0C0C0);
46    }
47
48    @Override
49    protected View createView(int position, ViewGroup parent, int desiredHeight) {
50        View view = super.createView(position, parent, desiredHeight);
51        view.setBackgroundColor(0xFF000000);
52        ((TextView) view).setTextSize(16.0f);
53        return view;
54    }
55}
56