布局文件如下:<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="76dip"
    android:background="#0000AA"
    android:orientation="horizontal" >    <EditText
        android:layout_width="0dip"
        android:layout_height="38dip"
        android:layout_weight="1"
        android:background="#FF0000"
        android:hint="好好学习,天天向上"
        android:singleLine="false" />    <Button
        android:layout_width="38dip"
        android:layout_height="38dip"
        android:background="#FFFF00"
        android:text="无" /></LinearLayout>发现显示效果始终如下,按钮总是靠下了一些像素,不知道是什么原因,高手们有没有解决办法呢?先谢谢了!

解决方案 »

  1.   

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="38dip"
        android:background="#0000AA"
        android:orientation="horizontal" >    <EditText
            android:layout_width="0dip"
            android:layout_height="38dip"
            android:layout_weight="1"
            android:background="#FF0000"
            android:hint="好好学习,天天向上"
            android:singleLine="false" />    <Button
            android:layout_width="38dip"
            android:layout_height="fill_parent"
            android:background="#FFFF00"
            android:text="无" /></LinearLayout>预览ok
      

  2.   

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="76dip" //高度也改成38dip试试,
        android:background="#0000AA"
        android:orientation="horizontal" >有文本的button挤出了点。
      

  3.   

    LinearLayout 中的高度改成38dip android:layout_height="38dip"
      

  4.   

    楼上各位的办法只不过是把多出来的button给截去了,上面还是有空隙的。如果我的button是个图片的话,就不完整了。
      

  5.   

    这个应该是显示效果问题,有可能是模拟器效果,也有可能你代码运行的真机/模拟器的API版本和你程序AndroidManifest.xml中指定的API版本不对应
      

  6.   

    好了,终于解决了,原来是两个控件按照自己的文字baseline对齐了,在父容器里设置一下不按照baseline对齐就OK了。还是感谢楼上诸位的热心!!!
      

  7.   

    多谢楼主了,我也遇到这样的问题了。果真是baseline的问题。