簡體   English   中英

在android中創建自定義搜索(在布局中插入搜索小部件)

[英]creating a custom search in android (inserting a search widget in the layout)

如何在Android應用布局中創建自定義搜索?

我可以使用顯示在活動窗口頂部的搜索對話框,但我想要類似於此處的圖像:

自定義搜索視圖 http://img5.imageshack.us/img5/1298/customsearch.gif

如果有示例代碼,我將非常感謝。

謝謝。

對不起,我的英語。

在res文件夾中進行搜索布局為

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@android:color/white" >

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/white">

            <EditText
                    android:id="@+id/searchText"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:layout_weight="1"/>

            <Button
                    android:id="@+id/searchButton"
                    android:text="Search"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:onClick="search"/>

        </LinearLayout>

        <ListView
            android:id="@android:id/list"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@android:color/white"/>

</LinearLayout>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM