2014-09-11 39 views
0

XML代碼如何使操作欄中的搜索小部件更大?這裏

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"> 



    <EditText android:id="@+id/find_text" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:layout_weight="1.0" 
       android:layout_marginLeft="5dip" 
       android:layout_marginRight="5dip" 
       android:contentDescription="@string/find_text" 
       android:background="@drawable/url_bar_entry" 
       android:singleLine="true" 
       android:textColor="#000000" 
       android:textCursorDrawable="@null" 
       android:inputType="text" 
       android:paddingLeft="15dip" 
       android:paddingRight="15dip" 
       android:textColorHighlight="@color/url_bar_text_highlight" 
       android:imeOptions="actionSearch" 
       android:selectAllOnFocus="true" 
       android:gravity="center_vertical|left"/> 

    <ImageButton android:id="@+id/find_prev" 
       style="@style/FindBar.ImageButton" 
       android:contentDescription="@string/find_prev" 
       android:src="@drawable/find_prev"/> 

    <ImageButton android:id="@+id/find_next" 
       style="@style/FindBar.ImageButton" 
       android:contentDescription="@string/find_next" 
       android:src="@drawable/find_next"/> 

    <ImageButton android:id="@+id/find_close" 
       style="@style/FindBar.ImageButton" 
       android:contentDescription="@string/find_close" 
       android:src="@drawable/find_close"/> 

</RelativeLayout> 

我用這個充氣菜單:

LayoutInflater inflater = LayoutInflater.from(mContext); 
View content = inflater.inflate(R.layout.find_in_page_content, null); 
EditText tv = (EditText) content.findViewById(R.id.find_text); 
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT); 
tv.setLayoutParams(params); 
//CODE TO ADD TO only EditText view to menu object I have 

這樣做的結果是在這裏看到:http://imgur.com/sQZ7Lbh

我的問題是:,哪能讓url欄佔用了actiobar的空間,而不是被限制在一個小廣場上。我也希望光標在按下時顯示,但不是。但是,我認爲這是固定的,當我使url欄更長。

回答

相關問題