blob: 0387e1ec5d13afae9ff52d866d03a3582efad792 [file] [log] [blame]
Kenny Root15a4d2f2010-03-11 18:20:12 -08001/*
2 * Copyright (C) 2009 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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080017package com.android.imftest.samples;
18
19import android.app.Activity;
20import android.os.Bundle;
21import android.view.KeyEvent;
22import android.view.View;
23import android.view.ViewGroup;
24import android.view.WindowManager;
25import android.widget.LinearLayout;
26import android.view.inputmethod.InputMethodManager;
27import android.widget.EditText;
28import android.widget.Button;
29import android.widget.TextView;
30import android.widget.ScrollView;
31
32import com.android.internal.R;
33
34/*
35 * Full screen of EditTexts (Scrollable, Pan&Scan)
36 */
37public class ManyEditTextActivityScrollPanScan extends Activity
38{
39 public static final int NUM_EDIT_TEXTS = 12;
40
41 private View mRootView;
42
43 @Override
44 public void onCreate(Bundle savedInstanceState)
45 {
46 super.onCreate(savedInstanceState);
47 mRootView = new ScrollView(this);
48
49 LinearLayout layout = new LinearLayout(this);
50 layout.setOrientation(LinearLayout.VERTICAL);
51
52 for (int i=0; i<NUM_EDIT_TEXTS; i++)
53 {
54 final EditText editText = new EditText(this);
55 editText.setText(String.valueOf(i));
56 editText.setId(i);
57 layout.addView(editText);
58 }
59
60 ((ScrollView) mRootView).addView(layout);
61 setContentView(mRootView);
62 this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
63 }
64
65 public View getRootView() {
66 return mRootView;
67 }
Kenny Root15a4d2f2010-03-11 18:20:12 -080068}