I find myself with the following dilemma suppose I have a control in this case a EditText
and below I have a Button
which allows me to follow the course of the app,
Now my problem is that I want that when you focus or click the EditText
my app scroll down to be able to see the button at the end, to not have to remove the keyboard to give the button, I leave a flow of images to understand it more clearly
Example 1 :
I put on the email, when doing this the keyboard will appear hiding the button that is behind,
What I would like is that when you type to write the email automatically, scroll upwards, something to be able to visualize the button to continue as I write, this only for the user's convenience, from now on thanks
VISTA XML
<EditText
android:id="@+id/txtCorreo"
android:inputType="textEmailAddress"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginRight="40dp"
android:textSize="@dimen/T14"
android:backgroundTint="@color/colorRayaEditText"
android:textColor="@color/HintHomeMonto"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:onClick="GoToRegistryStep2"
android:layout_centerHorizontal="true"
android:layout_width="match_parent"
android:layout_marginTop="5dp"
android:background="@color/colorFondoHomeAzulado"
android:text="@string/Continuar"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:id="@+id/iconodeaceptar"
android:layout_height="40dp"
android:textSize="@dimen/T14"
android:textColor="@color/white"/>
</RelativeLayout>
Methods you try so far
EditText txtCorreo = (EditText)findViewById(R.id.txtCorreo);
txtCorreo.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
if (hasFocus) {
final ScrollView sv = (ScrollView)findViewById(R.id.ScrollView01);
sv.post(new Runnable() {
public void run() {
sv.fullScroll(sv.FOCUS_DOWN);
}
});
} else {
Toast.makeText(getApplicationContext(), "Lost the focus", Toast.LENGTH_LONG).show();
}
}
});
And also try
txtCorreo.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View view, boolean hasFocus) {
if (hasFocus) {
ScrollView sv = (ScrollView)findViewById(R.id.ScrollView01);
sv.scrollTo(0, sv.getBottom());
} else {
Toast.makeText(getApplicationContext(), "Lost the focus", Toast.LENGTH_LONG).show();
}
}
});
preferably something that works for me from 4.1 Version onwards
Add the property to the manifest
<activity android:name="banred.twoinnovateit.com.bimo_new.RegistroStep1"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
>
</activity>
but still the keyboard hides my button