2011-09-19 63 views
2

我想知道是否有可能將搜索按鈕上的放大鏡更改爲文本「搜索」。我們希望將android的imeOptions設置保留爲android:imeOptions =「actionSearch」,因爲我們響應某個事件。android - ime選項有搜索按鈕說「搜索」,而不是放大鏡

以下是我有:

<EditText 
     android:id="@+id/txtSearch" 
     android:textSize="14px" 
     android:textColor="@color/main_text_black" 
     android:layout_width="189px" 
     android:layout_height="fill_parent" 
     android:imeOptions="actionSearch" 
     android:gravity="center_vertical" 
     android:singleLine="true" 
     android:background="@null" 
     android:layout_alignParentLeft="true" 
     android:layout_marginLeft="24px"/> 

enter image description here

試過這樣:

<EditText 
    android:id="@+id/txtSearch" 
    android:textSize="18dp" 
    android:textColor="@color/main_text_black" 
    android:layout_width="247dp" 
    android:layout_height="fill_parent" 
    android:imeOptions="actionSearch" 
    android:imeActionLabel="Search" 
    android:gravity="center_vertical" 
    android:singleLine="true" 
    android:background="@null" 
    android:layout_alignParentLeft="true" 
    android:layout_marginLeft="38dp"/> 

enter image description here

在橫向模式下這唯一的作品,我們的應用程序不支持和搜索詞出現在錯誤的位置地點。

+0

可能重複:http://stackoverflow.com/questions/7156427/android-keyboard-go-button-to-search/7156494#7156494 – NSjonas

+0

沒有在portret視圖中工作,同時在橫向模式下它仍然有放大鏡,搜索詞在頂部被覆蓋,但不是我需要它的地方。 – dropsOfJupiter

+0

你有沒有更改android:imeActionLabel =「搜索」與未指定的屬性在你的xml中,或者你在運行時使用java嗎? – NSjonas

回答

0

不,這是不可能的,除非您爲該EditText實現自己的鍵盤。鍵盤上的文本(或圖標)由編寫鍵盤的人控制。

2

你可以試試!

<EditText 
     android:id="@+id/edt_search_1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:imeOptions="actionSearch" 
     android:inputType="text"/>