Andorid: the keyboard appeares when the app is started

Posted by Briesanji on Stack Overflow See other posts from Stack Overflow or by Briesanji
Published on 2014-05-29T21:22:44Z Indexed on 2014/05/29 21:25 UTC
Read the original article Hit count: 382

Filed under:
|
|

I have coded an Android application composed by a LinearLayout(with an editbox and a button) and a ScrollView(with a LinearLayout that contains a TextView). When the app is started the keyboard pops up immediatly and I don't want this to happen. Have you got some advice??

THIS IS MY LAYOUT :

<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.b2875.Messaggi$PlaceholderFragment" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="70dp"
    android:layout_marginTop="650dp" >

    <EditText
        android:id="@+id/ScriviMessaggio"
        android:layout_width="332dp"
        android:layout_height="71dp"
        android:ems="10"
        android:hint="@string/scriviMessaggio" />

    <Button
        android:id="@+id/invia"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/invia" />

</LinearLayout>

<ScrollView
    android:id="@+id/scrollView1"
    android:scrollbarAlwaysDrawVerticalTrack="true"
    android:layout_width="fill_parent"
    android:layout_height="600dp"
    android:focusable="true"
    android:focusableInTouchMode="true" >

    <LinearLayout
        android:id="@+id/linearVertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/AreaMessaggi"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/messaggi" />
    </LinearLayout>
</ScrollView>

</RelativeLayout>

MY MANIFEST IS THIS:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.b2875"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:windowSoftInputMode="stateHidden"
        android:name="com.example.b2875.Messaggi"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

© Stack Overflow or respective owner

Related posts about android

Related posts about layout