2012-11-26 2 views
0

수직 라인을 추가하는 방법을 나는이있어 : enter image description here모양 레이아웃

을 그리고 내가 원하는 것은 : enter image description here

지금 색상을 신경 쓰지 마십시오. 나는 수평선을 어떻게 그리는 지 알아 냈지만 수직선은 생각하지 않았다. 수직선을 추가하는 방법은 무엇입니까?

내 row_border.xml (모양)입니다 :

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 
    <solid android:color="#ffffff" /> 
    <stroke android:width="1dp" android:color="#99cc00" /> 

</shape> 

이 이미 시도하지만, 작동하지 않았다 :

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 
    <solid android:color="#ffffff" /> 
    <stroke android:width="1dp" android:color="#99cc00" /> 

    <stroke 
     android:angle="90" 
     android:width="1dp" 
     android:color="#ff0000" 
     ></stroke> 

</shape> 
+0

당신이 사용하고있는 레이아웃? 사용자 정의 목록보기 또는 테이블보기? –

+0

@LazyNinja 테이블 뷰 미안하지만 질문에주의하는 것이 중요하다는 것을 알지 못했습니다. – Bigflow

답변

1

당신이 TableLayout을 사용하는 경우,

1 TableLayout 배경 제공 안드로이드 : background = "# 000000"

2 TableRow 다른 배경을 지정하십시오. 아픈 테두리 색상)

3이 TableRow 마진을 제공 (이 될 것입니다 테두리 너비)

왼쪽 여백 = 왼쪽 테두리

오른쪽 여백 = 오른쪽 테두리

상단 여백 = 위쪽 테두리

아래쪽 여백 = 아래쪽 테두리

enter image description here

상황에3210

<TableLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:background="#000000" > 

     <TableRow 
      android:id="@+id/tableRow1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="2dp" 
      android:background="#FFFFFF" > 

      <TextView 
       android:id="@+id/txt6" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/txt5" 
       android:text="Hello World 6" /> 
     </TableRow> 

     <TableRow 
      android:id="@+id/tableRow2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="2dp" 
      android:background="#FFFFFF" > 

      <TextView 
       android:id="@+id/txt6" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/txt5" 
       android:text="Hello World 6" /> 
     </TableRow> 

     <TableRow 
      android:id="@+id/tableRow3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="2dp" 
      android:background="#FFFFFF" > 

      <TextView 
       android:id="@+id/txt6" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/txt5" 
       android:text="Hello World 6" /> 
     </TableRow> 

     <TableRow 
      android:id="@+id/tableRow4" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="2dp" 
      android:background="#FFFFFF" > 

      <TextView 
       android:id="@+id/txt6" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/txt5" 
       android:text="Hello World 6" /> 
     </TableRow> 

     <TableRow 
      android:id="@+id/tableRow1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="2dp" 
      android:background="#FFFFFF" > 

      <TextView 
       android:id="@+id/txt6" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/txt5" 
       android:text="Hello World 6" /> 
     </TableRow> 

     <TableRow 
      android:id="@+id/tableRow2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="2dp" 
      android:background="#FFFFFF" > 

      <TextView 
       android:id="@+id/txt6" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/txt5" 
       android:text="Hello World 6" /> 
     </TableRow> 

     <TableRow 
      android:id="@+id/tableRow3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="2dp" 
      android:background="#FFFFFF" > 

      <TextView 
       android:id="@+id/txt6" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/txt5" 
       android:text="Hello World 6" /> 
     </TableRow> 

     <TableRow 
      android:id="@+id/tableRow4" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="2dp" 
      android:background="#FFFFFF" > 

      <TextView 
       android:id="@+id/txt6" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_toRightOf="@+id/txt5" 
       android:text="Hello World 6" /> 
     </TableRow> 
    </TableLayout> 

</LinearLayout> 
+0

는'textBackup '마다'setBackgroundResource'를 실행했습니다. 감사! – Bigflow

0

사용 TableLayout을

+0

그는 테이블 레이아웃을 사용하고있는 것으로 보입니다. 난 코멘트 섹션에서 질문을했습니다 –

+0

나는 프로그래밍 방식으로 (xml 파일이 아닌) 테이블을 만듭니다. – Bigflow