LZ确定就这段代码 , 就布局成这个效果了?!
你那个Button咋做的?

解决方案 »

  1.   

    LZ确定就这段代码 , 就布局成这个效果了?!
    你那个Button咋做的?
      

  2.   

    LZ给文本框添加Text ,看Text与按钮的相对位置。
    然后再把TextView的属性android:layout_height设置为wrap_content,同样添加Text , 你对照两个的效果 , 你就知道原因了。
      

  3.   

    代码就是这些代码,确定无误。BUTTON和TEXTVIEW混排就会有这个问题。
    另外,俺想知道引起这个问题的原因是什么,而不是求其它的解决方法。
      

  4.   

    确实有这个问题,TEXTVIEW的第一行文字,和BUTTON的文字在同一行上,而BUTTON的文字上方有大片空白,所以TEXTVIEW向下偏了。
    这是为什么呢。
      

  5.   


    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/main"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#66ff0000"
        android:gravity="fill">
        <TextView android:layout_width="50px"
            android:layout_height="100px"
            android:background="#77ffffff"/>
        <Button android:layout_width="50px"
            android:layout_height="100px"
            android:text="aaa"/>
        <TextView android:layout_width="50px"
            android:layout_height="100px"
            android:background="#77996688"/>
    </LinearLayout>
      

  6.   

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/main"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#66ff0000"
        android:gravity="fill">
        <TextView android:layout_width="50px"
            android:layout_height="100px"
            android:background="#77ffffff"/>
        <Button android:layout_width="50px"
            android:layout_height="100px"
            android:text="aaa"/>
        <TextView android:layout_width="50px"
            android:layout_height="100px"
            android:background="#77996688"/>
    </LinearLayout>
      

  7.   

    文本框的文本对应按钮是居中的, 并且始终保持在自己内部控件的顶端 ,所以即使你把他们高度设为一样 , 它也不会对等。
    你在TextView里面添加android:gravity="center"这个属性 , 效果就出来了