2013-11-26 76 views
3

我不得不减少在Android上的搜索视图的高度,我已经设定的尺寸在XML文件中,但它出现如下如何降低android中搜索视图的高度?

enter image description here

我如何降低光标的大小(搜索这里提示不能完美显示)。 我想设置文本的搜索视图大小为“X”按钮的大小相同

搜索查看XML是如下

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
    android:paddingLeft="5dip" > 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentTop="true" 
     android:layout_marginLeft="6dp" 
     android:text="@string/medium_text" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 

    <LinearLayout 
     android:id="@+id/listView" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/searchView" 
     android:orientation="horizontal" 
     android:weightSum="10" > 

     <SearchView 
      android:id="@+id/searchView" 
      android:layout_width="0dp" 
      android:layout_height="25dp" 
      android:layout_below="@+id/textView1" 
      android:layout_weight="9" 
      android:imeOptions="actionSearch" 
      android:textSize="2dp" > 
     </SearchView> 

     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="5dp" 
      android:layout_weight="0.5" 
      android:onClick="hierOnclick" 
      android:src="@drawable/ic_list" /> 

     <ImageView 
      android:id="@+id/imageView2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="5dp" 
      android:layout_weight="0.5" 
      android:src="@drawable/icon_add_account" /> 
    </LinearLayout> 
.... 
...... 
........ 
</LinearLayout> 

我不能设置高度WRAP_CONTENT(请推荐一些其他路)

编辑:感谢您的意见 我想创建一个搜索组件,如下

enter image description here

为了实现这个目标,可以为搜索视图设置方形背景。但我无法调整搜索视图的高度。

请帮我

非常感谢您

+0

您指定的android:layout_height =“25dp” –

+0

**邮整个XML代码** –

+0

@SweetWisher是的,我想在一个特定的大小 – Amith

回答

0

的问题是与EditText上行距控制。 你应该设置:

在XML:

android:lineSpacingExtra="0" 
android:lineSpacingMultiplier="0" 

OR

代码: 使用以下方法:

public void setLineSpacing (float add, float mult) 

Android SetLineSpacing() documentation