2012-09-12 2 views

답변

-1

이 희망 도움을 시도

list_item.xml

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

    <!-- Cell contents --> 

</LinearLayout> 

list_selector.xml

<?xml version="1.0" encoding="utf-8"?> 
<selector xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item 
     android:state_selected="true" 
     android:drawable="@drawable/item_border_selected" 
    /> 
    <item 
     android:state_pressed="true" 
     android:drawable="@drawable/item_border_selected" 
    /> 
    <item 
     android:drawable="@drawable/item_border" 
    /> 
</selector> 

item_border.xml

,363,210
<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <solid 
     android:color="@android:color/transparent" 
    /> 
    <stroke 
     android:width="1px" 
     android:color="@color/list_divider" 
    /> 
</shape> 

item_border_selected.xml

<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <solid 
     android:color="@color/list_select" 
    /> 
    <stroke 
     android:width="1px" 
     android:color="@color/list_divider" 
    /> 
</shape> 

items_view.xml 크기를 두 번 모든 라인들이 그들의 이웃 세포 가입으로하기 때문에, 내가 디바이더 크기 1 x 1 픽셀 대신했다

<?xml version="1.0" encoding="utf-8"?> 
<GridView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_marginLeft="-1px" 
    android:layout_marginRight="-1px" 
    android:listSelector="@android:color/transparent" 
/> 

1dp이므로 일부 화면에서는 너무 크게 보이지 않습니다. 또한, 그리드 뷰를 양쪽에 선을 감추기 위해 음의 여백을 만들었습니다. 이 사람이 도움이되기를 바랍니다. here

+0

드로어 블 폴더 deepak에 이미지가 있습니다. 이미지 너비와 높이를 2dp 및 128dp로 설정하여이 이미지를 구분 기호로 추가해야합니다. 답이 적합하지 않습니다. 내 요구 사항 –

+0

유사 제품보기 : http://stackoverflow.com/a/7304166/435605. 두 대답은 모두 1 년 차이와 비슷합니다. 나는 그것이 신용을주지 않고 베껴지면 방황한다. –

+0

@kilaka 헤이 친구. 당신은 나의 대답의 끝에 여기에서 단어를 볼 수있다. 그리고 나는 나의 대답을 최신 정보로 업데이트하지 않았다. 확인 응답은 비슷하지만 원래 응답에 대한 크레딧을 이미주었습니다 .. 의견을 먼저 확인하십시오 .. –

관련 문제