Kenny Root | 15a4d2f | 2010-03-11 18:20:12 -0800 | [diff] [blame] | 1 | /* |
| 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 Project | 9066cfe | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 17 | package com.android.imftest.samples; |
| 18 | |
| 19 | import android.app.Activity; |
| 20 | import android.os.Bundle; |
| 21 | import android.view.View; |
| 22 | import android.view.WindowManager; |
| 23 | import android.widget.LinearLayout; |
| 24 | import android.widget.EditText; |
| 25 | import android.widget.ScrollView; |
| 26 | |
| 27 | /* |
| 28 | * Full screen of EditTexts (Scrollable, Resize) |
| 29 | */ |
| 30 | public class ManyEditTextActivityScrollResize extends Activity |
| 31 | { |
| 32 | public static final int NUM_EDIT_TEXTS = 12; |
| 33 | |
| 34 | private View mRootView; |
| 35 | |
| 36 | @Override |
| 37 | public void onCreate(Bundle savedInstanceState) |
| 38 | { |
| 39 | super.onCreate(savedInstanceState); |
| 40 | mRootView = new ScrollView(this); |
| 41 | |
| 42 | LinearLayout layout = new LinearLayout(this); |
| 43 | layout.setOrientation(LinearLayout.VERTICAL); |
| 44 | |
| 45 | for (int i=0; i<NUM_EDIT_TEXTS; i++) |
| 46 | { |
| 47 | final EditText editText = new EditText(this); |
| 48 | editText.setText(String.valueOf(i)); |
| 49 | editText.setId(i); |
| 50 | layout.addView(editText); |
| 51 | } |
| 52 | |
| 53 | ((ScrollView) mRootView).addView(layout); |
| 54 | setContentView(mRootView); |
| 55 | this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); |
| 56 | } |
| 57 | |
| 58 | public View getRootView() { |
| 59 | return mRootView; |
| 60 | } |
Kenny Root | 15a4d2f | 2010-03-11 18:20:12 -0800 | [diff] [blame] | 61 | } |