2016-06-17 6 views
0

私は3列のリストビューを持っています。 私は3つの部分で等しくそれらを区切るには、ディバイダを使用したいと思います。
たとえば、Android ListViewデバイダを均等に分割する

TEXT |テキスト| TEXT

FACE | GFRt | FOEE

しかし、私はそれがこの

ABCのように見ている分圧器を使用します| efef | fkejfe

dffewf |フェフェ| efie

私は遠く離れてアンドロイドから遠く離れているので、助けがあれば大いに感謝します。

私のXMLコードは以下の通りです:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal"> 

    <TextView 
     android:id="@+id/txtLabel1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_toLeftOf="@+id/divider1" 
     android:textAppearance="?attr/textAppearanceListItem" /> 

    <View 
     android:id="@+id/divider1" 
     android:layout_width="1dp" 
     android:layout_height="match_parent" 
     android:background="@android:color/black" /> 

    <TextView 
     android:id="@+id/txtLabel2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="@dimen/text_margin" 
     android:textAppearance="?attr/textAppearanceListItem" /> 


    <View 
     android:id="@+id/divider2" 
     android:layout_width="1dp" 
     android:layout_height="match_parent" 
     android:layout_toLeftOf="@+id/divider1" 
     android:background="@android:color/black" /> 

    <TextView 
     android:id="@+id/txtLabel3" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 

     android:layout_margin="@dimen/text_margin" 
     android:textAppearance="?attr/textAppearanceListItem" /> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"></RelativeLayout> 

</LinearLayout> 
+0

あなたのxmlファイルをここに追加してください –

+0

ヘルプは常にhogwarts.Butで最初に投稿されます。 –

+0

ok sir pls wait a second –

答えて

0

が均等にあなたの意見を分割するために、このレイアウトを使用します。

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal"> 

    <TextView 
     android:id="@+id/txtLabel1" 
     android:layout_width="0dp" 
     android:layout_weight="1" 
     android:layout_height="wrap_content" 
     android:layout_toLeftOf="@+id/divider1" 
     android:textAppearance="?attr/textAppearanceListItem"/> 

    <View 
     android:id="@+id/divider1" 
     android:layout_width="1dp" 
     android:layout_height="match_parent" 
     android:background="@android:color/black"/> 

    <TextView 
     android:id="@+id/txtLabel2" 
     android:layout_width="0dp" 
     android:layout_weight="1" 
     android:layout_height="wrap_content" 
     android:layout_margin="@dimen/text_margin" 
     android:textAppearance="?attr/textAppearanceListItem"/> 


    <View 
     android:id="@+id/divider2" 
     android:layout_width="1dp" 
     android:layout_height="match_parent" 
     android:layout_toLeftOf="@+id/divider1" 
     android:background="@android:color/black"/> 

    <TextView 
     android:id="@+id/txtLabel3" 
     android:layout_width="0dp" 
     android:layout_weight="1" 
     android:layout_height="wrap_content" 
     android:layout_margin="@dimen/text_margin" 
     android:textAppearance="?attr/textAppearanceListItem"/> 


</LinearLayout> 
+0

助けてくれてありがとう、それは動作します –

+0

ようこそ。答えを受け入れてくれてありがとう。 –

0
<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:orientation="horizontal"> 

<TextView 
    android:id="@+id/txtLabel1" 
    android:text="12345" 
    android:layout_marginRight="3dp" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_toLeftOf="@+id/divider1" 
    android:textAppearance="?attr/textAppearanceListItem" /> 

<View 
    android:id="@+id/divider1" 
    android:layout_width="1dp" 
    android:layout_height="match_parent" 
    android:background="@android:color/black" /> 

<TextView 
    android:id="@+id/txtLabel2" 
    android:text="12345" 
    android:layout_marginRight="3dp" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_margin="2dp" 
    android:textAppearance="?attr/textAppearanceListItem" /> 


<View 
    android:id="@+id/divider2" 
    android:layout_width="1dp" 
    android:layout_height="match_parent" 
    android:layout_toLeftOf="@+id/divider1" 
    android:background="@android:color/black" /> 

<TextView 
    android:text="12345" 
    android:id="@+id/txtLabel3" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_marginRight="3dp" 
    android:layout_margin="2dp" 
    android:textAppearance="?attr/textAppearanceListItem" /> 



</LinearLayout> 
+0

これはちょうど分かれていますが、等しくはありません。それは私のものとほとんど同じテキストビューの側に仕切りを置くだけです。 –

0

これを試してみてください。..

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:orientation="horizontal"> 

<TableLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

    <TableRow 
    android:id="@+id/tableRow1" 
    android:layout_height="wrap_content" 
    android:layout_width="match_parent"> 

    <TextView 
    android:id="@+id/txtLabel1" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:layout_toLeftOf="@+id/divider1" 
    android:textAppearance="?attr/textAppearanceListItem" /> 

<View 
    android:id="@+id/divider1" 
    android:layout_width="1dp" 
    android:layout_height="match_parent" 
    android:background="@android:color/black" /> 

<TextView 
    android:id="@+id/txtLabel2" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:layout_margin="@dimen/text_margin" 
    android:textAppearance="?attr/textAppearanceListItem" /> 


<View 
    android:id="@+id/divider2" 
    android:layout_width="1dp" 
    android:layout_height="match_parent" 
    android:layout_toLeftOf="@+id/divider1" 
    android:background="@android:color/black" /> 

<TextView 
    android:id="@+id/txtLabel3" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_weight="1" 
    android:layout_margin="@dimen/text_margin" 
    android:textAppearance="?attr/textAppearanceListItem" /> 


    </TableRow> 

</TableLayout> 

</LinearLayout> 

これはあなたを助けることを願っています。

関連する問題