2013-10-22 13 views
8

したがって、XML android:divider属性を使用して、LinearLayoutのビュー間に仕切線を配置しようとしています。垂直のLinearLayoutを使用すると、ディバイダは表示されません。水平のLinearLayoutを使用すると、ディバイダが表示され、正常に動作します。LinearLayout垂直ディバイダ?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:orientation="vertical" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:divider="@drawable/one" 
       android:dividerPadding="10dp" 
       android:showDividers="middle"> 
<TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:text="test1" 
      /> 

<TextView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:text="test2" 
      /> 

</LinearLayout> 

は、垂直リニアレイアウトで分周属性を使用することはできませんか:

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <size android:width="1dip" /> 
    <solid android:color="#FFFFFF" /> 
</shape> 

そして、ここでは私のLinearLayoutである:ここで私は分周器(drawable/one.xml)のために使用しています引き出し可能です私は何かを欠いている?垂直レイアウトの

答えて

24

は、描画可能で、私はあなたが

<size android:height="1dip" /> 
+1

かというと

<size android:width="1dip" /> 

を交換する必要があると思う、次の2つのドロウアブル、1dipに設定幅のものを持っている必要があります、そして高さが1dipに設定されているもの – scrayne

+1

あなたは自分を殺さないように私を救った;) – marioosh

+0

くそ、それは明らかだったはずだ。ありがとう。 – LiveMynd