2016-10-22 63 views
0

下面的代碼生成結果的藍圖:意見線性佈局不正確對齊

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@drawable/marker_shape"> 

    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/marker_header"> 

     <TextView 
      android:id="@+id/widget_1_header_from" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_height="wrap_content" 
      android:ellipsize="end" 
      android:maxLines="1"/> 

     <Button 
      android:id="@+id/widget_1_refresh" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:background="@drawable/quantum_ic_refresh_white_24"/> 

    </LinearLayout> 

    <ListView 
     android:id="@+id/widget_1_list" 
     android:footerDividersEnabled="false" 
     android:headerDividersEnabled="false" 
     android:layout_width="match_parent" 
     android:dividerHeight="0dp" 
     android:layout_height="wrap_content"> 

    </ListView> 

</LinearLayout> 

正如你可以看到:TextView的被顯示在按鈕下方。他們需要彼此相鄰。我該如何解決?

blueprint

回答

0

你有2種選擇:

  1. 更改按鈕的高度wrap_content

或:

  • 改變您的TextView高度match_parent
  • +0

    不知道爲什麼,但它的工作。謝謝! – Dendrowen