115a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root/*
215a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * Copyright (C) 2009 The Android Open Source Project
315a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root *
415a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * Licensed under the Apache License, Version 2.0 (the "License");
515a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * you may not use this file except in compliance with the License.
615a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * You may obtain a copy of the License at
715a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root *
815a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root *      http://www.apache.org/licenses/LICENSE-2.0
915a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root *
1015a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * Unless required by applicable law or agreed to in writing, software
1115a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * distributed under the License is distributed on an "AS IS" BASIS,
1215a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1315a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * See the License for the specific language governing permissions and
1415a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root * limitations under the License.
1515a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root */
1615a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root
179066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectpackage com.android.imftest.samples;
189066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
199066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.app.Activity;
209066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.os.Bundle;
219066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.view.View;
229066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.view.WindowManager;
239066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.widget.LinearLayout;
249066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.widget.EditText;
259066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectimport android.widget.ScrollView;
269066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
279066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project/*
289066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project * Full screen of EditTexts (Scrollable, Resize)
299066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project */
309066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Projectpublic class ManyEditTextActivityScrollResize extends Activity
319066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project{
329066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public static final int NUM_EDIT_TEXTS = 12;
339066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
349066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    private View mRootView;
359066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
369066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    @Override
379066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public void onCreate(Bundle savedInstanceState)
389066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    {
399066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        super.onCreate(savedInstanceState);
409066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        mRootView = new ScrollView(this);
419066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
429066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        LinearLayout layout = new LinearLayout(this);
439066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        layout.setOrientation(LinearLayout.VERTICAL);
449066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
459066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        for (int i=0; i<NUM_EDIT_TEXTS; i++)
469066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        {
479066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            final EditText editText = new EditText(this);
489066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            editText.setText(String.valueOf(i));
499066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            editText.setId(i);
509066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project            layout.addView(editText);
519066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        }
529066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
539066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        ((ScrollView) mRootView).addView(layout);
549066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        setContentView(mRootView);
559066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
569066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
579066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project
589066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    public View getRootView() {
599066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project        return mRootView;
609066cfe9886ac131c34d59ed0e2d287b0e3c0087The Android Open Source Project    }
6115a4d2ffd04dc6c70f2cd17dae12ac6bc14c69abKenny Root}
62