There are many questions and answers about how to stop an edittext gaining focus on activity startup.
However, all of the solutions do work for me and the edittext doesn't gain focus at start up, but this stops the scroll view from scrolling.
I tried almost all of the solutions in the post:
Stop EditText from gaining focus at Activity startup
and it doesn't work with scroll view in the activity.
This is causing me much trouble. Any help would be great.
Thanks
Tried the following:
Dummy item to prevent AutoCompleteTextView from receiving focus
Set attributes of edit text: Set the attributes android:focusable="true" and android:focusableInTouchMode="true"
Here is my xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/content_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:showIn="#layout/activity_home">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:fitsSystemWindows="false">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:id="#+id/progressBar"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:visibility="gone" />
<TextView
android:id="#+id/textViewLinkToOrder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:gravity="center"
android:text="Click here to book travel insurance."
android:textColor="#color/colorPrimary"
android:textSize="24sp"
/>
<LinearLayout
android:id="#+id/buttons_linear_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/textViewLinkToOrder"
android:orientation="horizontal">
<Button
android:id="#+id/choose_country_button"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_below="#id/textViewLinkToOrder"
android:layout_centerHorizontal="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="#color/colorPrimary"
android:onClick="onChooseCountryButtonClick"
android:text="Choose country"
android:textColor="#ffff" />
<Button
android:id="#+id/automatic_country_button"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_below="#id/choose_country_button"
android:layout_centerHorizontal="true"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="#color/colorPrimary"
android:text="My Location"
android:textColor="#fff" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayoutAllDetails"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/buttons_linear_layout"
android:orientation="vertical">
<TextView
android:id="#+id/textView_coumtry_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:padding="5dp"
android:text="No country yet selected"
android:textColor="#000000"
android:textSize="30sp"
android:textStyle="bold" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#e8e8e8"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<EditText
android:id="#+id/editTextFromCurrency"
android:layout_width="80sp"
android:layout_height="50sp"
android:background="#drawable/edit_txt_bg"
android:ems="10"
android:inputType="number"
android:text="1" />
<TextView
android:id="#+id/textViewFromCurrency"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:gravity="center"
android:text="None"
android:textColor="#000000"
android:textSize="17sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal">
<EditText
android:id="#+id/editTextToCurrency"
android:layout_width="80sp"
android:layout_height="50sp"
android:background="#drawable/edit_txt_bg"
android:ems="10"
android:inputType="number"
android:text="1" />
<TextView
android:id="#+id/textViewToCurrency"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
android:gravity="center"
android:text="New Israeli Shekel"
android:textColor="#000000"
android:textSize="17sp" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="20dp">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="#drawable/police" />
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="Police"
android:textColor="#000000"
android:textSize="17sp" />
<TextView
android:id="#+id/police_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text=""
android:textColor="#000000"
android:textSize="17sp" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<ImageView
android:id="#+id/police_phone_button"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:src="#android:drawable/sym_action_call" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="20dp">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="#drawable/ambulance" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="Ambulance"
android:textColor="#000000"
android:textSize="17sp" />
<TextView
android:id="#+id/ambulance_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text=""
android:textColor="#000000"
android:textSize="17sp" />
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<ImageView
android:id="#+id/ambulance_phone_button"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:src="#android:drawable/sym_action_call" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="20dp">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="#drawable/israel_consulate" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="Israel Consulate"
android:textColor="#000000"
android:textSize="17sp" />
<TextView
android:id="#+id/israel_consulate_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text=""
android:textColor="#000000"
android:textSize="17sp" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<ImageView
android:id="#+id/israel_phone_button"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:src="#android:drawable/sym_action_call"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="20dp">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="#drawable/chabad" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="Chabad"
android:textColor="#000000"
android:textSize="17sp" />
<TextView
android:id="#+id/chabad_number_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text=""
android:textColor="#000000"
android:textSize="17sp" />
<TextView
android:id="#+id/chabad_address_text_view"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text=""
android:textColor="#000000"
android:textSize="13sp" />
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<ImageView
android:id="#+id/chabad_phone_button"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:src="#android:drawable/sym_action_call" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
One alternative to get the result you want is hide the device's virtual keyboard. This will inhibit the EditText to gain focus thus not scrolling the screen. You can achieve this with this function:
public static void hideKeyboard(Activity activity) {
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Activity.INPUT_METHOD_SERVICE);
//Find the currently focused view, so we can grab the correct window token from it.
View view = activity.getCurrentFocus();
//If no view currently has focus, create a new one, just so we can grab a window token from it
if (view == null) {
view = new View(activity);
}
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
Called this way: hideKeyboard(this);, preferentially inside your onCreate() method.
If user taps EditText, virtual keyboard is showed again.
Related
I am working on a tablet with android version 7.0, I'm having a display issue while clicking on the listview cell of the first fragment (on the left side) to display the information details on the second fragment (on the right side). It takes at least 5 seconds to display. There are many views that are gone. I have been stuck for the last couple of days and I couldn't fix it.
<ScrollView
android:id="#+id/scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="#+id/section1"
layout="#layout/layout_section1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp" />
<include
android:id="#+id/section2"
layout="#layout/layout_section2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/layout_section1"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp" />
<include
android:id="#+id/section3"
layout="#layout/layout_section3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/layout_section2"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp" />
<LinearLayout
android:id="#+id/layout_buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/section3"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:weightSum="3">
<Button
android:id="#+id/button1"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="#color/section"
android:drawableLeft="#drawable/icon_guide"
android:text="#string/guide"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textColor="#color/white_color"
android:textSize="14sp" />
<Button
android:id="#+id/button2"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="#color/section"
android:drawableLeft="#drawable/icon_modif"
android:text="#string/modifier"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textColor="#color/white_color"
android:textSize="14sp" />
<Button
android:id="#+id/button3"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_marginLeft="5dp"
android:layout_weight="1"
android:background="#color/section"
android:drawableLeft="#drawable/icon_delete"
android:text="#string/supprimer"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:textColor="#color/white_color"
android:textSize="14sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/layout_edit_validate_cancel_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/section3"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:visibility="gone"
android:weightSum="2"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="#+id/validate_button"
android:layout_width="78dp"
android:layout_height="35dp"
android:layout_gravity="center"
android:layout_marginRight="20dp"
android:background="#drawable/register_button_bg"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="#string/validate_button"
android:textColor="#color/white_color"
android:textSize="14sp" />
<Button
android:id="#+id/cancel_button"
android:layout_width="78dp"
android:layout_height="35dp"
android:layout_gravity="center"
android:background="#drawable/register_button_bg"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="#string/cancel_button"
android:textColor="#color/white_color"
android:textSize="14sp" />
</LinearLayout>
<View
android:id="#+id/separator"
android:layout_width="match_parent"
android:layout_height="0.7dp"
android:layout_gravity="center_horizontal"
android:background="#color/light_grey"
android:layout_marginTop="20dp"/>
</LinearLayout>
<LinearLayout
android:id="#+id/layout_pwd_validate_update"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/section3"
android:layout_marginLeft="35dp"
android:orientation="vertical"
android:paddingBottom="30dp"
android:visibility="gone">
<com.example.ui.RobotoTextView
android:id="#+id/validation_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:background="#android:color/white"
android:maxWidth="300dp"
android:text="#string/validation_message"
android:textSize="16dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginBottom="20dp"
android:layout_marginRight="40dp"
android:layout_marginTop="10dp"
android:background="#drawable/background_border"
android:orientation="vertical">
<EditText
android:id="#+id/password_edit"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/transparent"
android:gravity="right|center"
android:inputType="numberPassword"
android:maxLength="6"
android:paddingRight="10dp"
android:textColor="#color/black_color" />
</LinearLayout>
<Button
android:id="#+id/validate_button"
android:layout_width="78dp"
android:layout_height="35dp"
android:layout_gravity="center"
android:layout_marginBottom="40dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:background="#drawable/register_button_bg"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="#string/validate_button"
android:textColor="#color/white_color"
android:textSize="14dp"
android:visibility="gone"/>
</LinearLayout>
<RelativeLayout
android:id="#+id/progress_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/transparent_grey"
android:visibility="gone">
<ProgressBar
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerInParent="true" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
<com.example.ui.KeyboardViewNumber
android:id="#+id/keyboard_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/keyboard_color"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="bottom"
android:keyBackground="#drawable/push_keyboard_btn"
android:keyTextColor="#000000"
android:keyTextSize="25dp"
android:paddingTop="1dp"
android:shadowColor="#FFFFFF"
android:shadowRadius="0.0"
android:visibility="visible" />
i found the solution, and the best way to resolve my problem is to use only Relative Layouts. The Linear Layouts caused me lots of problems when rendring.
I have my views in a scroll view so that if the content is bigger than the screen size, the user can scroll down. I have noticed a weird thing.
The first time the content comes up, it doesn't scroll. However, when the user changes a setting and the content of the views which are inside the scroll view reloads it does become scrollable.
Why is this? Is it clear what I mean?
EDIT: This only happens on my Nexus 5X. But when I used a Samsung J10 it works right away.
My XML is a relative layout, with a child element of the scroll view, which contains other views.
Here is my xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/content_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="com.apps.reuven.egertandcohentravel.Activities.HomeActivity"
tools:showIn="#layout/activity_home">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:layout_width="50dp"
android:id="#+id/progressBar"
android:layout_height="50dp"
android:layout_centerInParent="true"
android:visibility="gone"
/>
<TextView
android:id="#+id/textViewLinkToOrder"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click here to book travel insurance."
android:textColor="#color/colorPrimary"
android:layout_centerHorizontal="true"
android:textSize="24sp"
android:gravity="center"
/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/buttons_linear_layout"
android:orientation="horizontal"
android:layout_below="#id/textViewLinkToOrder">
<Button
android:layout_width="200dp"
android:id="#+id/choose_country_button"
android:onClick="onChooseCountryButtonClick"
android:layout_height="wrap_content"
android:text="Choose country"
android:layout_marginLeft="5dp"
android:background="#color/colorPrimary"
android:layout_weight="1"
android:textColor="#ffff"
android:layout_marginRight="5dp"
android:layout_below="#id/textViewLinkToOrder"
android:layout_centerHorizontal="true"/>
<Button
android:layout_width="200dp"
android:layout_weight="1"
android:background="#color/colorPrimary"
android:textColor="#fff"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:id="#+id/automatic_country_button"
android:layout_height="wrap_content"
android:text="My Location"
android:layout_below="#id/choose_country_button"
android:layout_centerHorizontal="true"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="#+id/linearLayoutAllDetails"
android:layout_below="#id/buttons_linear_layout"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="No country yet selected"
android:gravity="center"
android:id="#+id/textView_coumtry_name"
android:textColor="#000000"
android:textSize="30sp"
android:padding="5dp"
android:textStyle="bold"
android:layout_weight="1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
>
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="#drawable/police"/>
<TextView
android:textSize="17sp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Police"
android:textColor="#000000"
android:layout_gravity="center_vertical" />
<TextView
android:layout_marginLeft="10dp"
android:textSize="17sp"
android:layout_marginRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/police_text_view"
android:text=""
android:textColor="#000000"
android:layout_gravity="center_vertical"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"
/>
<ImageView
android:id="#+id/police_phone_button"
android:layout_width="30dp"
android:layout_gravity="center_vertical"
android:layout_height="30dp"
android:src="#android:drawable/sym_action_call"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="#drawable/ambulance"/>
<TextView
android:textSize="17sp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ambulance"
android:textColor="#000000"
android:layout_gravity="center_vertical" />
<TextView
android:layout_marginLeft="10dp"
android:textSize="17sp"
android:layout_marginRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/ambulance_text_view"
android:text=""
android:textColor="#000000"
android:layout_gravity="center_vertical"/>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"
/>
<ImageView
android:layout_width="30dp"
android:layout_gravity="center_vertical"
android:layout_height="30dp"
android:src="#android:drawable/sym_action_call"
android:id="#+id/ambulance_phone_button"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="#drawable/israel_consulate"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:textSize="17sp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Israel Consulate"
android:textColor="#000000"
android:layout_gravity="center_vertical" />
<TextView
android:layout_marginLeft="10dp"
android:textSize="17sp"
android:layout_marginRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/israel_consulate_text_view"
android:text=""
android:textColor="#000000"
android:layout_gravity="center_vertical"/>
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"
/>
<ImageView
android:layout_width="30dp"
android:layout_gravity="center_vertical"
android:layout_height="30dp"
android:src="#android:drawable/sym_action_call"
android:id="#+id/israel_phone_button"
/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="20dp"
android:paddingBottom="20dp"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:src="#drawable/chabad"/>
<LinearLayout
android:layout_width="250dp"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:textSize="17sp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Beit Chabad"
android:textColor="#000000"
android:layout_gravity="center_vertical" />
<TextView
android:layout_marginLeft="10dp"
android:textSize="17sp"
android:layout_marginRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/chabad_address_text_view"
android:text="3 Blue Street, USA"
android:textColor="#000000"
android:layout_gravity="center_vertical"/>
<TextView
android:layout_marginLeft="10dp"
android:textSize="17sp"
android:layout_marginRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/chabad_number_text_view"
android:text="+44 456 3245234"
android:textColor="#000000"
android:layout_gravity="center_vertical"/>
</LinearLayout>
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"
/>
<ImageView
android:layout_width="30dp"
android:layout_gravity="center_vertical"
android:layout_height="30dp"
android:src="#android:drawable/sym_action_call"
android:id="#+id/chabad_phone_button"
/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</ScrollView>
Thanks very much, I can't figure this one out.
I also had the same problem and by adding a TableLayout inside ScrollView solved the problem for me. Then, add your content (RelativeLayout) inside TableLayout.
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:stretchColumns="1">
<-- Your RelativeLayout goes here -->
</TableLayout>
</ScrollView>
Let me know if that solved the problem. Do not forget to add the attribute fillViewport=true to ScrollView so the TableLayout match it's parent's view width and height.
I have a layout with Text,2 Spinners, 1 EditText and 1 Button on the end. When i want to enter something in EditText that button get covered by Keyboard.
This is Fragment not Activity if it's making any difference.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="#color/transparentlightgrey">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="#+id/SectionName"
android:layout_width="fill_parent"
android:layout_height="56dp"
android:background="#color/neonGreen"
android:textColor="#C6D600"
android:textSize="20sp"
android:textStyle="normal|bold">
<TextView
android:id="#+id/textView14"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="false"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:text="Add Credit"
android:textColor="#color/lightGrey"
android:textSize="20dp"
android:textStyle="bold" />
</RelativeLayout>
<LinearLayout
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/AddPointsHolder"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginTop="10dp"
android:orientation="vertical">
<Spinner
android:id="#+id/spinneroperater"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="#d8d8d8"
android:spinnerMode="dialog" />
<Spinner
android:id="#+id/spinnerTopUp"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="#d8d8d8"
android:spinnerMode="dialog"
android:touchscreenBlocksFocus="false" />
<EditText
android:id="#+id/phoneNumber"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_below="#+id/linearLayout"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:background="#drawable/edit_text_border"
android:ems="10"
android:hint="Enter Phone number"
android:inputType="number"
android:maxLength="12"
android:paddingLeft="5dp"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="18dp" />
</LinearLayout>
<TextView
android:id="#+id/AddPointsHolder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/SectionName"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:text="#string/addPoints"
android:textColor="#ffffff" />
<Button
android:id="#+id/addPoints"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/linearLayout"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="#drawable/rounded_button_clickable"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Add Credit" />
</RelativeLayout>
</ScrollView>
</RelativeLayout>
adjustPan doesn't resize the screen. Since you have a scrolling view, you should be using adjustResize.
From the docs on adjustPan:
The activity's main window is not resized to make room for the soft keyboard. Rather, the contents of the window are automatically panned so that the current focus is never obscured by the keyboard and users can always see what they are typing. This is generally less desirable than resizing, because the user may need to close the soft keyboard to get at and interact with obscured parts of the window.
Do this.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:background="#color/white"
android:orientation="vertical">
<ScrollView
android:id="#+id/login_form"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<LinearLayout
android:id="#+id/email_login_form"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:padding="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Credit"
android:id="#+id/textView14"
android:textColor="#color/lightGrey"
android:textSize="20dp"
android:textStyle="bold"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="false"
android:layout_marginLeft="10dp" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/AddPointsHolder"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="#+id/linearLayout"
android:layout_marginTop="10dp">
<Spinner
android:layout_width="fill_parent"
android:layout_height="40dp"
android:id="#+id/spinneroperater"
android:spinnerMode="dialog"
android:layout_weight="1"
android:background="#d8d8d8"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" />
<Spinner
android:layout_width="fill_parent"
android:layout_height="40dp"
android:id="#+id/spinnerTopUp"
android:spinnerMode="dialog"
android:layout_weight="1"
android:layout_marginTop="10dp"
android:background="#d8d8d8"
android:touchscreenBlocksFocus="false"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp" />
<EditText
android:layout_width="fill_parent"
android:layout_height="40dp"
android:inputType="number"
android:ems="10"
android:id="#+id/phoneNumber"
android:hint="Enter Phone number"
android:background="#drawable/edit_text_border"
android:textSize="18dp"
android:paddingLeft="5dp"
android:layout_below="#+id/linearLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp"
android:maxLength="12"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#ffffff"
android:textColorHint="#ffffff" />
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/addPoints"
android:id="#+id/AddPointsHolder"
android:layout_below="#+id/SectionName"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:textColor="#ffffff" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Credit"
android:id="#+id/addPoints"
android:layout_below="#+id/linearLayout"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:background="#drawable/rounded_button_clickable"
android:paddingRight="10dp"
android:paddingLeft="10dp" />
</LinearLayout>
</ScrollView>
</LinearLayout>
When i enter EditText box for typing window is overlap with layout .How to solve this overlapping issue with soft keyboard.
Here is image of layout.
I have tried this android:windowSoftInputMode="adjustPan" in particular activity tag in manifest.xml file .How to avoid such over lapping issues.
Here is my xml file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:expandableTextView="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
android:id="#+id/relative_one"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:background="#3A86CF">
<ImageView
android:id="#+id/imgBack_AllPostDetails"
android:layout_width="35dp"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:scaleType="center"
android:src="#android:drawable/ic_menu_revert" />
<TextView
android:id="#+id/text_Vesselname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Vessel name"
android:textColor="#android:color/white"
android:textSize="20sp"
android:textStyle="bold|normal" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/relative_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relative_one"
android:layout_marginTop="7dp"
android:focusable="false"
android:orientation="horizontal">
<ImageView
android:id="#+id/itemview_imgProFilePic"
android:layout_width="48dp"
android:layout_height="50dp"
android:background="#drawable/img_round_corner"
android:gravity="center"
android:scaleType="fitXY"
android:src="#drawable/avtaaar" />
<TextView
android:id="#+id/item_textInspectorName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_toRightOf="#+id/itemview_imgProFilePic"
android:gravity="center_vertical|center_horizontal|left"
android:paddingLeft="7sp"
android:text="Birger"
android:textColor="#android:color/widget_edittext_dark"
android:textSize="10sp"
android:textStyle="normal" />
<TextView
android:id="#+id/item_textSpChar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_toRightOf="#+id/item_textInspectorName"
android:gravity="center_vertical|center_horizontal|left"
android:text="#string/my_string"
android:textColor="#android:color/widget_edittext_dark"
android:textSize="10sp"
android:textStyle="normal" />
<TextView
android:id="#+id/item_textNotation"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_toRightOf="#+id/item_textSpChar"
android:gravity="center_horizontal|clip_vertical|left"
android:maxLines="1"
android:text="Notation"
android:textColor="#android:color/widget_edittext_dark"
android:textSize="10sp"
android:textStyle="normal" />
<TextView
android:id="#+id/item_txt_Date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginTop="8dp"
android:layout_weight="0.5"
android:gravity="center_vertical|center_horizontal|right"
android:paddingRight="6sp"
android:text="DATE"
android:textColor="#android:color/widget_edittext_dark"
android:textSize="10sp"
android:textStyle="normal" />
<TextView
android:id="#+id/item_textDescid"
android:layout_width="0dp"
android:layout_height="0dp"
android:background="#android:color/white"
android:textColor="#android:color/white"
android:visibility="invisible" />
<com.example.SlideMenuDemo.ExpandableTextView
android:id="#+id/item_textRemark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/item_textInspectorName"
android:layout_toRightOf="#+id/itemview_imgProFilePic"
expandableTextView:animAlphaStart="1"
expandableTextView:maxCollapsedLines="2">
<TextView
android:id="#+id/expandable_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="7.5dp"
android:layout_marginRight="10dp"
android:layout_marginTop="6dp"
android:fontFamily="sans-serif-light"
android:scrollbars="vertical"
android:text="Birger"
android:textColor="#android:color/black"
android:textSize="10sp"
android:textStyle="normal" />
<ImageButton
android:id="#id/expand_collapse"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_gravity="right|bottom"
android:background="#android:color/transparent" />
</com.example.SlideMenuDemo.ExpandableTextView>
</RelativeLayout>
<LinearLayout
android:id="#+id/imageLay"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/relative_layout"
android:layout_marginLeft="41dp"
android:orientation="vertical">
<HorizontalScrollView
android:id="#+id/item_hlist"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#android:color/white"
android:fillViewport="true"
android:measureAllChildren="false"
android:scrollbars="none">
<LinearLayout
android:id="#+id/item_innerlay"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="14dp"
android:background="#android:color/white"
android:orientation="horizontal">
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
<LinearLayout
android:id="#+id/buttonslayout"
android:layout_width="match_parent"
android:layout_height="26dp"
android:layout_below="#+id/imageLay"
android:layout_marginTop="3dp"
android:background="#D8D8D8"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:focusable="false" />
<ImageView
android:id="#+id/imgButton_FoloowUp"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_marginLeft="0dp"
android:layout_weight="1"
android:contentDescription="#string/desc"
android:scaleType="center"
android:src="#drawable/follow_up_grey" />
<TextView
android:id="#+id/textFollowCount"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="0.5"
android:gravity="center_vertical"
android:text="0"
android:textColor="#android:color/widget_edittext_dark"
android:textSize="12sp" />
<TextView
android:id="#+id/imgButton_StarRateEquipment"
android:layout_width="40dp"
android:layout_height="fill_parent"
android:layout_weight="0"
android:gravity="center_vertical|center_horizontal"
android:text="RG"
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.1" />
<ImageView
android:id="#+id/imgButton_RecordAudio"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="0.8"
android:contentDescription="#string/desc"
android:src="#drawable/recorder_gray" />
<TextView
android:id="#+id/textViewAudioCount"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="0.4"
android:gravity="center_vertical"
android:text="0"
android:textColor="#android:color/widget_edittext_dark"
android:textSize="12sp" />
<ImageView
android:id="#+id/imgButton_Camera"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="0.5"
android:contentDescription="#string/desc"
android:scaleType="fitEnd"
android:src="#drawable/camera_grey" />
<TextView
android:id="#+id/txtImageCount"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="0.4"
android:gravity="center_vertical|right"
android:padding="6sp"
android:text="0"
android:textColor="#android:color/widget_edittext_dark"
android:textSize="12sp" />
</LinearLayout>
<ListView
android:id="#+id/listViewAllPostItem"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_above="#+id/follow_post"
android:layout_below="#+id/buttonslayout"
android:layout_marginTop="3dp"
android:background="#android:color/white"
android:cacheColorHint="#00000000"
android:padding="5dp"></ListView>
<LinearLayout
android:id="#+id/follow_post"
android:layout_width="fill_parent"
android:layout_height="110dp"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:padding="5dp">
<EditText
android:id="#+id/edittext_FollowUpmessage"
android:layout_width="150dp"
android:layout_height="90dp"
android:layout_marginLeft="4dp"
android:layout_weight="1"
android:background="#drawable/rounded_corner"
android:gravity="left"
android:inputType="text|textCapWords|textMultiLine"
android:maxLines="10"
android:maxLength="140"
android:padding="5sp"
android:scrollbars="vertical"
android:text="Enter text here."
android:textColor="#android:color/black"
android:textSize="14sp" />
<RelativeLayout
android:layout_width="50dp"
android:layout_height="100dp"
android:layout_weight="0.2">
<Button
android:id="#+id/btnPostFollowUp_ItemDetail"
android:layout_width="50dp"
android:layout_height="40dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginLeft="3dp"
android:background="#drawable/rounded_corner"
android:text="Post"
android:textColor="#android:color/black"
android:textSize="14sp" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<!--
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="#android:color/white"
></RelativeLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="none" >-->
If this EditText is inside ScrollView than similar issue occured with me, i have tried following code ,
In your AndroidManifest file add this to your activity,
android:windowSoftInputMode="stateAlwaysHidden|adjustResize"
Now , in your class try following code as per your ID's you have given in xml,
editMsj = (EditText) findViewById(R.id.editMsj);
editMsj.setOnTouchListener(new View.OnTouchListener() {
#Override
public boolean onTouch(View v, MotionEvent event) {
if (v.getId() == R.id.editMsj) {
v.getParent().requestDisallowInterceptTouchEvent(true);
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_UP:
v.getParent().requestDisallowInterceptTouchEvent(false);
break;
}
}
return false;
}
});
I have a layout for ldpi with some elements inside a scrowview.
I have two edittexts and when I click one of then, the keyboard
is overriding the edittext. Its haoening only in this screen and only in
this size of screnn. I have others layouts files with edittexts and It happens
only in this layout.
This is the code:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".NovoCheckinActivity" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="67dp"
android:layout_weight="0.03"
android:background="#drawable/header"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/imgVoltaNovoCheckin"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="7dp"
android:layout_marginTop="13dp"
android:src="#drawable/bt_back"
android:onClick="voltaNovoCheckin"/>
<TextView
android:id="#+id/labelAutenticacaoNovoCheckin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/imgVoltaNovoCheckin"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/imgVoltaNovoCheckin"
android:text="Novo Check-in"
android:textColor="#android:color/white"
android:textSize="18sp" />
<TextView
android:id="#+id/tvEventoClienteNovoCheckin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/imgVoltaNovoCheckin"
android:layout_marginLeft="10dp"
android:layout_toRightOf="#+id/imgVoltaNovoCheckin"
android:text="Reuniao - Porto Seguro"
android:textColor="#android:color/white" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="8"
android:orientation="vertical" >
<ScrollView
android:layout_width="wrap_content"
android:layout_height="380dp" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="410dp"
android:focusableInTouchMode="true"
android:layout_weight="1.03" >
<TextView
android:id="#+id/labelTipoCheckin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="24dp"
android:layout_marginTop="5dp"
android:text="Tipo:"
android:textColor="#333333" />
<Button
android:id="#+id/btTipoCheckin"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/labelTipoCheckin"
android:layout_centerHorizontal="true"
android:layout_marginLeft="50dp"
android:layout_marginTop="2dp"
android:background="#drawable/borda_botao"
android:hint="Chegada/Saída/Presença" />
<Button
android:id="#+id/btLocal"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/labelLocal"
android:layout_centerHorizontal="true"
android:layout_marginLeft="50dp"
android:layout_marginTop="2dp"
android:background="#drawable/borda_botao"
android:hint="Empresa/Cliente/Minha Casa" />
<EditText
android:id="#+id/etObservacoesNovoCheckin"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_below="#+id/labelObservacoes"
android:layout_centerHorizontal="true"
android:layout_marginLeft="50dp"
android:layout_marginTop="2dp"
android:background="#drawable/borda_botao"
android:paddingLeft="5dp" >
</EditText>
<TextView
android:id="#+id/labelLocal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/labelTipoCheckin"
android:layout_below="#+id/btTipoCheckin"
android:text="Local:"
android:textColor="#333333" />
<EditText
android:id="#+id/etCustoNovoCheckin"
android:layout_width="match_parent"
android:layout_height="38dp"
android:layout_below="#+id/labelCustoNovoCheckin"
android:layout_centerHorizontal="true"
android:layout_marginLeft="50dp"
android:background="#drawable/borda_botao"
android:inputType="numberDecimal"
android:paddingLeft="5dp" />
<Button
android:id="#+id/btSalvarNovoCheckin"
android:layout_width="150dp"
android:layout_height="35dp"
android:layout_below="#+id/etCustoNovoCheckin"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:layout_weight="0.03"
android:background="#drawable/bt_green"
android:text="Salvar"
android:textColor="#android:color/white"
android:textSize="20sp" />
<TextView
android:id="#+id/labelObservacoes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/labelLocal"
android:layout_below="#+id/btLocal"
android:layout_marginTop="10dp"
android:text="Observações:"
android:textColor="#333333" />
<TextView
android:id="#+id/labelCustoNovoCheckin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/btCheck"
android:layout_below="#+id/btCheck"
android:layout_marginTop="10dp"
android:text="Custo:"
android:textColor="#333333" />
<ImageView
android:id="#+id/invisible"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_alignRight="#+id/labelTipoCheckin"
android:layout_alignTop="#+id/btCheck"
android:src="#drawable/invisible" />
<TextView
android:id="#+id/labelCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/invisible"
android:layout_marginTop="5dp"
android:layout_toRightOf="#+id/labelCustoNovoCheckin"
android:text="Último Check-in do evento?"
android:textSize="13sp" />
<ImageView
android:id="#+id/btCheck"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_alignRight="#+id/invisible"
android:layout_below="#+id/etObservacoesNovoCheckin"
android:layout_marginTop="10dp"
android:background="#drawable/btunchecked" />
</RelativeLayout>
</ScrollView>
</LinearLayout>
take a look at the activity android:windowSoftInputMode modes to help with your adjustment of items on screen