I have a scroll view containing a Linearlayout which contains some controls.
The controls has to be centered in the main view, so I wrapped the scroll view with a RelativeLayout and set the android:layout_centerInParent="true" which works fine.
The problem is that when I try to enter a text in the first Edittext and the tablet is in landscape mode and the keyboard appears, then the Editbox disappears and you are not able to scroll up to see the first Editbox. (I think the reason is the android:layout_centerInParent="true")
How can I solve this problem to be able to scroll up and down to see all the controls when the keyboard appears.
The Layout file is the following:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/relativeLayout1">
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="12dp"
android:paddingBottom="20dp"
android:scrollbarStyle="outsideOverlay"
android:layout_centerInParent="true" >
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center">
<LinearLayout
android:focusable="true"
android:focusableInTouchMode="true"
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="0dp"
android:layout_height="0dp"
android:id="#+id/LayoutDummy" />
<TextView
android:text="#string/Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/textView4" />
<EditText
android:inputType="textPersonName"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/EdName" />
<TextView
android:text="#string/Name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/textView4" />
<EditText
android:inputType="textPersonName"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/EdName" />
<TextView
android:text="#string/Password"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/textView5" />
<EditText
android:inputType="textPassword"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/EdPassword" />
<TextView
android:text="#string/Mandant"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/textView5" />
<EditText
android:inputType="numberSigned"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:id="#+id/EdMandant" />
<EditText
android:inputType="textNoSuggestions"
android:layout_width="359.2dp"
android:layout_height="wrap_content"
android:id="#+id/EdLoginUrl"
android:layout_marginTop="11.6dp" />
<CheckBox
android:text="Offline"
android:id="#+id/cbOffline"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_marginTop="7.9dp" />
<TableLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/tableLayout1"
android:paddingTop="20dp">
<TableRow
android:id="#+id/tableRow1"
android:layout_gravity="center_horizontal"
android:gravity="center">
<Button
android:text="Ok"
android:id="#+id/BtnOk"
android:layout_column="0"
android:layout_width="100dp" />
<Button
android:text="Cancel"
android:layout_column="1"
android:id="#+id/BtnCancel"
android:layout_width="100dp" />
</TableRow>
</TableLayout>
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="#+id/linearLayout1"
android:paddingTop="20dp">
<Button
android:id="#+id/BtnSetting"
android:layout_height="36dp"
android:layout_width="36dp"
android:layout_gravity="center"
android:background="#drawable/ic_action_settings"
android:gravity="top" />
<TextView
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/txtResult"
android:gravity="center"
android:paddingTop="20dp" />
</LinearLayout>
</LinearLayout></ScrollView></RelativeLayout>
try using linear layout instead of relative layout with
android:layout_gravity="center"
Try putting
android:windowSoftInputMode="adjustResize"
inside your activity defined in manifest file.
Related
So I have 5 EditText's and the virtual soft keyboard work almost fine with the windowSoftInputMode="adjustPan" but the 4th EditText element is hidden (by the keyboard) when I hit 'next' to go to the next edit text.
*only when I start writing the UI gets up and I can see the EditText
XML Code: (The problematic element is the EditText with 'email' id.)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:minWidth="25px"
android:minHeight="25px"
android:weightSum="5">
<RelativeLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/user_container"
android:gravity="right"
android:layout_weight="0">
<TextView
android:text="Register"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:id="#+id/textView1"
android:textColor="#FFFFFF"
android:gravity="right" />
</RelativeLayout>
<LinearLayout
android:orientation="horizontal"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/linearLayout1"
android:background="#ffffff"
android:layout_weight="0">
<ImageView
android:src="#drawable/logo_full"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:padding="40dp"
android:id="#+id/imageView1" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_marginTop="20dp"
android:layout_height="wrap_content"
android:id="#+id/linearLayout2"
android:gravity="top"
android:layout_weight="3">
<RelativeLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/keycode_container"
android:gravity="center"
android:layout_marginBottom="0.5dp"
android:layout_weight="1">
<ImageView
android:src="#drawable/keycodelogo"
android:layout_width="22.0dp"
android:layout_height="22.0dp"
android:id="#+id/keycode_lable"
android:tint="#d9e5f3"
android:layout_alignParentRight="true" />
<EditText
android:id="#+id/keycode"
android:layout_width="197.0dp"
android:layout_height="35.5dp"
android:textSize="14dp"
android:layout_toLeftOf="#id/keycode_lable"
android:inputType="text"
android:hint="קוד רישום"
android:gravity="right"
android:textColorHint="#d9e5f3"
android:textColor="#fff" />
</RelativeLayout>
<RelativeLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/user_container"
android:gravity="center"
android:layout_weight="1">
<ImageView
android:src="#drawable/userlogo"
android:layout_width="22dp"
android:layout_height="22.0dp"
android:id="#+id/user_lable"
android:tint="#d9e5f3"
android:layout_alignParentRight="true" />
<EditText
android:id="#+id/user"
android:layout_width="197.0dp"
android:layout_height="35.5dp"
android:textSize="14dp"
android:layout_toLeftOf="#id/user_lable"
android:hint="#string/username"
android:inputType="text"
android:textColorHint="#d9e5f3"
android:textColor="#fff"
android:nextFocusDown="#+id/pass" />
</RelativeLayout>
<RelativeLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/pass_container"
android:gravity="center"
android:layout_marginBottom="0.5dp"
android:layout_weight="1">
<ImageView
android:src="#drawable/passlogo"
android:layout_width="22.0dp"
android:layout_height="22.0dp"
android:id="#+id/pass_lable"
android:tint="#d9e5f3"
android:layout_alignParentRight="true" />
<EditText
android:id="#+id/pass"
android:layout_width="197.0dp"
android:layout_height="35.5dp"
android:textSize="14dp"
android:layout_toLeftOf="#+id/pass_lable"
android:inputType="textPassword"
android:gravity="end"
android:hint="#string/password"
android:textColorHint="#d9e5f3"
android:textColor="#fff"
android:nextFocusDown="#+id/email"/>
</RelativeLayout>
<RelativeLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/email_container"
android:gravity="center"
android:layout_weight="1">
<ImageView
android:src="#drawable/maillogo"
android:layout_width="22.0dp"
android:layout_height="22.0dp"
android:id="#+id/email_lable"
android:tint="#d9e5f3"
android:layout_alignParentRight="true" />
<EditText
android:id="#+id/email"
android:layout_width="197.0dp"
android:layout_height="35.5dp"
android:textSize="14dp"
android:inputType="text"
android:layout_toLeftOf="#+id/email_lable"
android:hint="#string/email"
android:textColorHint="#d9e5f3"
android:textColor="#fff"
android:nextFocusDown="#+id/email"/>
</RelativeLayout>
<RelativeLayout
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/phone_container"
android:gravity="center"
android:layout_weight="1">
<ImageView
android:src="#drawable/mobilelogo"
android:layout_width="22.0dp"
android:layout_height="22.0dp"
android:id="#+id/phone_lable"
android:tint="#d9e5f3"
android:layout_alignParentRight="true" />
<EditText
android:id="#+id/phone"
android:layout_width="197.0dp"
android:layout_height="35.5dp"
android:textSize="14dp"
android:layout_toLeftOf="#+id/phone_lable"
android:hint="#string/phone_num"
android:gravity="end"
android:inputType="phone"
android:textColorHint="#d9e5f3"
android:textColor="#fff" />
</RelativeLayout>
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:padding="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/register_container"
android:gravity="center"
android:layout_weight="1">
<Button
android:text="Register"
android:layout_width="132.0dp"
android:layout_height="42.5dp"
android:id="#+id/register"
android:background="#drawable/loginbutton"
android:textColor="#color/black"
android:textStyle="bold"
android:gravity="center" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
What can cause this?
tl;dr softKeyboard hides only 1 element out of five, and its the one with 'email' id.
So thanks to #Jay_Thummar I solved the problem.
wrapping the layout with ScrollView and changing the SoftInputMode to AdjustResize it worked.
Hi in the below code i have these layout. once touch inside username edittext i want to move full layout upwards.onfousing the keyboard should be stay like that want to move full layout upwards
Can any one help me
layout
<ScrollView 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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#drawable/texture">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="#FFFFFF"
android:orientation="vertical"
android:id="#+id/login">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:paddingTop="100dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#6E6864"
android:text="Sign in to continue"
android:id="#+id/login_tv_sign_continue" />
<EditText
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:paddingLeft="10dp"
android:hint="User Name"
android:id="#+id/login_ed_username"
android:background="#drawable/edit_text_back"
android:imeOptions="actionNext"
android:singleLine="true"
/>
<EditText
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:paddingLeft="10dp"
android:hint="Password"
android:id="#+id/login_ed_password"
android:background="#drawable/edit_text_back"
android:imeOptions="actionDone"
android:singleLine="true"
android:inputType="textPassword"
/>
<Button
android:layout_width="300dp"
android:layout_height="50dp"
android:layout_marginTop="20dp"
android:textColor="#6E6864"
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="#+id/login_btn_login"
android:text="Sign In"
android:background="#ECBC3B"
/>
<TextView
android:layout_width="300dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="#+id/txt_forgetpwd"
android:text="Forgot Password?"
android:gravity="right"
android:layout_marginTop="20dp"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/logo"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
/>
</RelativeLayout>
</LinearLayout>
</ScrollView>
I'm trying to add a header to my layout and I don't want the gap between two layouts.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/linearLayoutContainer"
android:gravity="center">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Fixed Header"
android:textColor="#ff00ff"
android:background="#00ff00" />
<ScrollView
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:id="#+id/scrollView">
<LinearLayout
android:orientation="vertical"
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/linearLayoutContainer"
android:gravity="center">
<EditText
android:gravity="center|center_vertical"
android:id="#+id/etFirstName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_top_bg"
android:padding="10dp"
android:hint="نــام"
android:textColorHint="#bbbbbb" />
<EditText
android:gravity="center|center_vertical"
android:id="#+id/etLastName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_default_bg"
android:padding="10dp"
android:hint="نام خانوادگي"
android:textColorHint="#bbbbbb" />
<EditText
android:gravity="center|center_vertical"
android:id="#+id/etNCode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_default_bg"
android:padding="10dp"
android:hint="کد ملي"
android:textColorHint="#bbbbbb" />
<EditText
android:gravity="center|center_vertical"
android:id="#+id/etMobile"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/edittext_bottom_bg"
android:padding="10dp"
android:hint="شماره همراه"
android:textColorHint="#bbbbbb" />
<View
style="#style/Gap" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/linearLayoutRegisterCancel"
android:layout_gravity="clip_vertical"
android:gravity="center">
<Button
android:id="#+id/btnCancel"
android:layout_width="100px"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="بي خيال"
style="#style/DefaultButtonText"
android:background="#drawable/button_default_bg"
android:gravity="center_vertical|center_horizontal" />
<Button
android:id="#+id/btnRegister"
android:layout_width="100px"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="تمومه"
style="#style/DefaultButtonText"
android:background="#drawable/button_default_bg"
android:gravity="center_vertical|center_horizontal" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
As you can see in the following image, there's gap between "Fixed Header" text view and the main layout. How can I remove this gap?
Change your scrollview android:padding="10dp" to
android:paddingTop="10dp"
android:paddingBottom="10dp"
Dear All experts I have problem with using scrollView anyone please help.. the Error is showing that the ScrollView is useless and also in other form of mine is shows the same , how can I solve this and how can I make my forms and activities been scroll ??
`
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:text="#string/welcome"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:layout_margin="30dp"
android:contentDescription="#+id/button1"
android:src="#drawable/ic_launcher" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/username"
android:textAppearance="?android:attr/textAppearanceSmall" />
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="text" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/password"
android:textAppearance="?android:attr/textAppearanceSmall" />
<EditText
android:id="#+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:orientation="vertical" >
<Button
android:id="#+id/button1"
style="android:buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="goToMain"
android:text="#string/log_in" />
<Button
android:id="#+id/button2"
style="android:buttonStyle "
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="register"
android:text="#string/registration" />
</LinearLayout>
</ScrollView>
`
You need a child container as LinearLayout, TableLayout or RelativeLayout in your ScrollView like this:
<ScrollView
... >
<LinearLayout
... >
<!-- Your views: TextView, LinearLayout, etc. -->
</LinearLayout>
</ScrollView>
According to the reference:
A ScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll
You should put all the other fields in a single Layout.. Like linear layout,relative layout. Your whole code should look like this
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="30dp"
android:text="#string/welcome"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView
android:id="#+id/imageView1"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center"
android:layout_margin="30dp"
android:contentDescription="#+id/button1"
android:src="#drawable/ic_launcher" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="20dp"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/username"
android:textAppearance="?android:attr/textAppearanceSmall" />
<EditText
android:id="#+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="text" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/password"
android:textAppearance="?android:attr/textAppearanceSmall" />
<EditText
android:id="#+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"
android:orientation="vertical" >
<Button
android:id="#+id/button1"
style="android:buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="goToMain"
android:text="#string/log_in" />
<Button
android:id="#+id/button2"
style="android:buttonStyle "
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="register"
android:text="#string/registration" />
</LinearLayout>
</LinearLayout>
</ScrollView>
"Scrollview can host only one direct child"
Put all your stuff in some Layout e.g LinearLayout
i've a layout like:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#android:color/background_dark"
android:weightSum="1" >
<LinearLayout
android:id="#+id/layout_splash"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.3" >
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:src="#drawable/logo" />
</LinearLayout>
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:orientation="vertical" >
<TextView
android:id="#+id/testoCaricamento"
android:layout_gravity="center"
android:textSize="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TextView" />
<LinearLayout
android:id="#+id/layoutNomeTablet"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_marginTop="40dp"
android:layout_height="wrap_content"
android:weightSum="1" >
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:textSize="20dp"
android:layout_marginRight="15dp"
android:layout_weight="0.2"
android:text="Nome tablet" />
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5" >
<requestFocus />
</EditText>
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_weight="0.1"
android:text="Salva" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
When my splashscreen is shown, keyboard appears even if the layout that contain the EditText has visibility gone. how can i show keyboard only when edittext is visible and focused?
Try making this change in your EditText.
<EditText
android:id="#+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=""
</EditText>