-2

I want to make custom search bar layout in android. I have to attach screenshot of my design what I want to require. Check action bar design. On click action-bar search icon open custom edit-text in toolbar.

I want to make action bar layout like this.

Show Design

1 Answers1

0

Try this way make sure you have search icon..

 <LinearLayout
            android:id="@+id/llSearchContainer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@dimen/_5sdp"
            android:background="@drawable/drawer_gredient"
            android:gravity="center_vertical"
            android:orientation="horizontal"
            android:padding="@dimen/_10sdp">

            <LinearLayout
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_weight="0.80"
                android:background="@drawable/edittext_search_box"
                android:gravity="center_vertical"
                android:paddingBottom="@dimen/_2sdp"
                android:paddingLeft="@dimen/_5sdp"
                android:paddingRight="@dimen/_5sdp"
                android:paddingTop="@dimen/_2sdp">

                <ImageView
                    android:layout_width="@dimen/_24sdp"
                    android:layout_height="@dimen/_24sdp"
                    android:padding="@dimen/_5sdp"
                    android:scaleType="centerCrop"
                    android:src="@drawable/ic_seach" />

                <EditText
                    android:id="@+id/lsfEtSearch"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="@dimen/_10sdp"
                    android:layout_weight="0.80"
                    android:background="@android:color/transparent"
                    android:drawablePadding="@dimen/_10sdp"
                    android:hint="Search"
                    android:imeOptions="actionSearch"
                    android:inputType="text"
                    android:maxLength="50"
                    android:maxLines="1"
                    android:textSize="@dimen/_14sdp" />
            </LinearLayout>
        </LinearLayout>