안드로이드의 리스트뷰에서 리스트의 각 항목간 간격을 설정할수있을까요?

조회수 3136회

발생하는 문제 및 실행환경

제가 리스트뷰에서 항목사이에 거리를 두려고 marginBottom을 썼는데요. 별다른 변화가 없었어요. 항목마다 거리를 두게하려면 어떻게하죠?

에러메시지(있는 경우)

소스코드

<LinearLayout
android:id="@+id/alarm_occurences"
android:layout_width="fill_parent" 
android:orientation="vertical"
android:layout_height="fill_parent"
android:background="#EEEEFF"
xmlns:android="http://schemas.android.com/apk/res/android">

<ListView
android:id="@+id/occurences"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
<com.android.alarm.listItems.AlarmListItem
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" 
android:background="@drawable/alarm_item_background"
android:layout_marginBottom="10dp"    
>
<CheckedTextView     
    android:id="@android:id/text1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:checkMark="?android:attr/listChoiceIndicatorMultiple"
    android:textSize="20sp"
    android:textStyle="bold"
    android:typeface="serif"
    android:padding="10dp"

/>

</com.android.alarm.listItems.AlarmListItem>

이건 제 코드에요

1 답변

  • 좋아요

    0

    싫어요
    채택 취소하기

    리스트뷰에서 구분선을 투명하게 만들고 구분선의 높이를 지정하는 방식으로 하시면 될 것 같습니다.

    <ListView android:id="@+id/MyListView"
      android:layout_height="match_parent"
      android:layout_width="match_parent"
      android:divider="@android:color/transparent"
      android:dividerHeight="10.0sp"/>
    

    dividerHeight에서 원하시는 거리만큼 설정하시면됩니다.

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)