MaterialSearchView icon indicating copy to clipboard operation
MaterialSearchView copied to clipboard

Keyboard doesn't show up automatically

Open itabdullah1 opened this issue 9 years ago • 2 comments

I use the search view inside coordinator layout-->Appbar layout-->Collapsing toolbar. When the search view opens the keyboard doesn't show up automatically. However if I click on the editable area after the search view opens the keyboard shows up. How to show keyboard automatically when the search view opens. Here is my xml.

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/main_content" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true">

<android.support.design.widget.AppBarLayout
    android:id="@+id/appbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:fitsSystemWindows="true"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/collapsing_toolbar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"
        app:contentScrim="?attr/colorPrimary"
        app:expandedTitleTextAppearance="@android:color/transparent"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">

        <ImageView
            android:id="@+id/backdrop"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            android:paddingBottom="@dimen/b_padding_home_pic"
            android:paddingEnd="40dp"
            android:paddingStart="40dp"
            android:paddingTop="@dimen/t_padding_home_pic"
            android:scaleType="fitCenter"
            android:src="@drawable/app_name"
            app:layout_collapseMode="parallax" />

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            app:layout_collapseMode="pin"
            app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

        <com.miguelcatalan.materialsearchview.MaterialSearchView
            android:id="@+id/search_view"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:hint="@string/search_menu"
            android:textColor="@color/colorAccent"
            app:layout_collapseMode="pin"
            app:searchBackIcon="@drawable/ic_arrow_back_white_24dp"
            app:searchBackground="?attr/colorPrimary"
            app:searchCloseIcon="@drawable/ic_close_white_24dp" />

    </android.support.design.widget.CollapsingToolbarLayout>

    <android.support.design.widget.TabLayout
        android:id="@+id/tabs"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="true"
        android:layoutDirection="ltr"
        app:tabTextAppearance="@style/MyCustomTabText" />

</android.support.design.widget.AppBarLayout>

<android.support.v4.view.ViewPager
    android:id="@+id/viewpager_home"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>

itabdullah1 avatar Jul 31 '16 09:07 itabdullah1

Did you find solution? Can anyone help us?

muhammedaydogan avatar Aug 02 '19 14:08 muhammedaydogan

It is working for me now. Same code. Not sure why it was not working before. Pasting the code below:

<android.support.design.widget.CoordinatorLayout 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:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fitsSystemWindows="false"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:contentScrim="@color/appBarBackground"
            app:expandedTitleMarginEnd="64dp"
            app:expandedTitleMarginStart="48dp"
            app:layout_scrollFlags="scroll|enterAlways">

            <ImageView
                android:id="@+id/backdrop"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:fitsSystemWindows="false"

                android:paddingEnd="50dp"
                android:paddingStart="50dp"
                android:paddingTop="20dp"
                android:scaleType="fitCenter"
                app:layout_collapseMode="parallax"
                app:srcCompat="@drawable/ic_about" />

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                android:background="@color/colorAccent"
                android:minHeight="?attr/actionBarSize"
                app:layout_collapseMode="pin"

                app:popupTheme="@style/ThemeOverlay.AppCompat"
                app:theme="@style/ThemeOverlay.AppCompat.ActionBar" />

            <com.miguelcatalan.materialsearchview.MaterialSearchView
                android:id="@+id/search_view"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_collapseMode="pin"
                app:searchSuggestionIcon="@drawable/ic_history_grey_600_24dp" />
        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

<......./>

</android.support.design.widget.CoordinatorLayout>

itabdullah avatar Aug 02 '19 17:08 itabdullah