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
17package com.android.imftest.samples;
18
19import com.android.imftest.R;
20
21import android.app.Activity;
22import android.os.Bundle;
23import android.view.View;
24import android.view.ViewGroup;
25import android.view.WindowManager;
26import android.widget.LinearLayout;
27import android.widget.ScrollView;
28
29public class BigEditTextActivityScrollableResize extends Activity {
30
31    private View mRootView;
32    private View mDefaultFocusedView;
33    private LinearLayout mLayout;
34
35    @Override
36    protected void onCreate(Bundle icicle) {
37        super.onCreate(icicle);
38
39        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
40
41        mRootView = new ScrollView(this);
42        ((ScrollView) mRootView).setFillViewport(true);
43        mRootView.setLayoutParams(new ViewGroup.LayoutParams(
44                ViewGroup.LayoutParams.MATCH_PARENT,
45                ViewGroup.LayoutParams.MATCH_PARENT));
46
47        mLayout = new LinearLayout(this);
48        mLayout.setOrientation(LinearLayout.VERTICAL);
49        mLayout.setLayoutParams(new ViewGroup.LayoutParams(
50                ViewGroup.LayoutParams.MATCH_PARENT,
51                ViewGroup.LayoutParams.MATCH_PARENT));
52
53        View view = getLayoutInflater().inflate(
54                R.layout.full_screen_edit_text, ((ScrollView) mRootView), false);
55
56        mLayout.addView(view);
57
58        ((ScrollView) mRootView).addView(mLayout);
59        mDefaultFocusedView = view.findViewById(R.id.data);
60
61        setContentView(mRootView);
62    }
63
64    public View getRootView() {
65        return mRootView;
66    }
67
68    public View getDefaultFocusedView() {
69        return mDefaultFocusedView;
70    }
71
72}
73