views:

110

answers:

1

In android 1.5 sdk, with QVGA800 skin(resolution), I added 8 EditText in LinearLayout. When 8th EditText box is tapped, the onscreen appears. However, layout doesnt move up enough, I mean, it moves up however it still covers EditText box which is being typed. How to solve this ?

Main Class :

package com.i;

import android.app.Activity;
import android.os.Bundle;
import android.widget.EditText;

public class myClass extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        EditText txt1=(EditText)findViewById(R.id.txt1);
        EditText txt2=(EditText)findViewById(R.id.txt2);
        EditText txt3=(EditText)findViewById(R.id.txt3);
        EditText txt4=(EditText)findViewById(R.id.txt4);
        EditText txt5=(EditText)findViewById(R.id.txt5);
        EditText txt6=(EditText)findViewById(R.id.txt6);
        EditText txt7=(EditText)findViewById(R.id.txt7);
        EditText txt8=(EditText)findViewById(R.id.txt8);
    }
}

main.xml :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    />
    <EditText android:id="@+id/txt1" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    <EditText android:id="@+id/txt2" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    <EditText android:id="@+id/txt3" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    <EditText android:id="@+id/txt4" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    <EditText android:id="@+id/txt5" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    <EditText android:id="@+id/txt6" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    <EditText android:id="@+id/txt7" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    <EditText android:id="@+id/txt8" android:layout_width="fill_parent" android:layout_height="wrap_content"/>

</LinearLayout>

Thanks.

+1  A: 

Wrap it all in a scroll view. Just change your main.xml to

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
<LinearLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
<TextView  
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
    />
    <EditText android:id="@+id/txt1" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    <EditText android:id="@+id/txt2" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    <EditText android:id="@+id/txt3" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    <EditText android:id="@+id/txt4" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    <EditText android:id="@+id/txt5" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    <EditText android:id="@+id/txt6" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    <EditText android:id="@+id/txt7" android:layout_width="fill_parent" android:layout_height="wrap_content"/>
    <EditText android:id="@+id/txt8" android:layout_width="fill_parent" android:layout_height="wrap_content"/>

</LinearLayout>
</ScrollView>
infinitypanda
Good idea but I want this done automatically.
Prabhat
It does. It'll automatically scroll to show whichever one you've selected.
infinitypanda