2015-01-16 2 views
0

열에있는 각 항목 사이에 공백을 추가하고 싶습니다. 각 행 사이에 작은 공백을 추가하고 싶습니다. 패딩, 분할기를 적용하여 null을 적용했습니다. 제 경우에는 작동하지 않습니다. .각 항목과 각 행 사이의 간격

내가 목록보기에 분할 높이를 추가 한 코드 아래에 가지고 있지만

<LinearLayout android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 

    <ListView android:id="@+id/listView" 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="1" 
     android:divider="@android:color/transparent" 
     android:dividerHeight="10.0sp"/>/> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:textSize="25dp" 
     android:textStyle="bold" 
     android:text="total and comment section" /> 
    </LinearLayout> 

and items layout is which displays items in the listview 

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


    <TextView 
     android:id="@+id/textView1" 
     android:layout_gravity="center" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textSize="25dp" 
     android:text="TextView" /> 

    <TextView 
     android:id="@+id/textView2" 
     android:layout_gravity="center" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textSize="25dp" 
     android:text="TextView" /> 

</LinearLayout> 

답변

0

사용자 정의 ArrayAdapter와의 목록보기의 각 행에 패딩이나 마진을 설정하려고 했 밖으로 작동하지?

+0

나는 사용자 정의 클래스에서 설정하는 방법 레이아웃에서 재판을 더 – sarah

+0

http://www.ezzylearning.com/tutorial/customizing-android-listview-items-with-custom 없다 -arrayadapter - 맞춤 어댑터에 대한 간단한 튜토리얼 http://www.vogella.com/tutorials/AndroidListView/article.html - ListView로 작업하는 방법에 대한 포괄적 인 자습서 –

0
 for space in row you want to set dividerHeight of listview 
     and for column 
     you want to set android:layout_marginLeft for right text view 

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

      <TextView 
       android:id="@+id/textView1" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:text="TextView" 
       android:textSize="25dp" /> 

      <TextView 
       android:id="@+id/textView2" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="center" 
       android:layout_marginLeft="50dp" 
       android:text="TextView" 
       android:textSize="25dp" /> 

     </LinearLayout> 
+0

데이터 길이가 각 열에 대해 고정 폭을 설정하고 싶습니다. 더 잘라야한다. – sarah

0

보십시오이

android:layout_height="0dp" 
android:layout_weight="1" 
android:divider="#00000000" 
android:dividerHeight="5dp"