如何在android中通过Deafolt折叠searchView
我是android新手,在android中使用searchView控件,我在我的活动中放置了一个searchView,我的问题是,当我执行任何操作时,我的键盘会打开,因为我的searchView默认打开,有人能告诉我,当我的活动开始时,如何使我的serachView默认关闭?我的代码如下:如何在android中通过Deafolt折叠searchView,android,android-softkeyboard,searchview,Android,Android Softkeyboard,Searchview,我是android新手,在android中使用searchView控件,我在我的活动中放置了一个searchView,我的问题是,当我执行任何操作时,我的键盘会打开,因为我的searchView默认打开,有人能告诉我,当我的活动开始时,如何使我的serachView默认关闭?我的代码如下: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/
<?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" >
<SearchView
android:id="@+id/searchViewSearchPosts"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:showAsAction="collapseActionView|ifRoom"
android:iconifiedByDefault="true"
android:queryHint="Search.." >
</SearchView>
<FrameLayout
android:id="@+id/fragmentTimeline"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_marginTop="0dp" />
</LinearLayout>
manifest.xml
<activity
android:name="one.tusk.stush.SearchPostActivity"
android:parentActivityName="one.tusk.stush.activities.MainActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustNothing"
android:label="Back">
>
</activity>
>
AndroidManifest.xml中将以下行添加到您的活动条目中android:windowSoftInputMode=“stateHidden | adjustNothing”@Clinkz-未发生任何事情(我觉得这很难相信。设置了SoftInputMode
后,VKB不会自动出现。请您也发布您的AndroidManifest好吗?@Clinkz-当然可以,兄弟。请稍候。)2mins@Clinkz-请看我的编辑。