ListView 행 항목의 일부인 ImageView를 갖기를 원하지만, 행 안팎에 나타납니다. 이것이 가능한가? 그렇다면 어떻게? 많은 뜻 방식으로하지 명시 적으로 적어도 사전에 감사 ... alt text http://www.freeimagehosting.net/uploads/a7e703a33f.png상자 외부에있는 것으로 생각되는 목록보기의 안드로이드 이미지
답변
나는 지금이 일을하고있다. 나는 포토샵을 전혀 사용하지 않았다. 나는 그것을 모두 안드로이드 XML을 사용했다.
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:top="6dip" android:right="6dip" android:left="6dip">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:bottomRightRadius="2dip"
android:bottomLeftRadius="2dip" android:topLeftRadius="6dip"
android:topRightRadius="6dip" />
<solid android:color="@color/list_view_outline" />
</shape>
</item>
<item android:top="8dip" android:right="8dip" android:left="8dip">
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:bottomRightRadius="2dip"
android:bottomLeftRadius="2dip" android:topLeftRadius="6dip"
android:topRightRadius="6dip" />
<solid android:color="@android:color/white" />
<stroke android:width="1dip" android:color="#BDBDBD" />
</shape>
</item>
그럼 그냥 목록 행에 대해 표준 행 레이아웃을 사용 :
을 할 수있는 방법은 다음과 같이, 패딩을 사용하지 않고 대신 사용하는 <layer-list>
요소를 사용하는 것입니다
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/feed_list_row_content">
<ImageView android:id="@+id/author_image"
android:layout_width="44dip" android:layout_height="44dip"
android:layout_alignParentTop="true" android:layout_alignParentLeft="true"
android:src="@drawable/no_photo" android:layout_marginLeft="10dip"
android:layout_marginTop="10dip" />
<TextView android:layout_width="wrap_content"
android:layout_marginTop="10dip" android:layout_height="wrap_content"
android:layout_toRightOf="@id/author_image" android:id="@+id/feed_message_content"
android:layout_toLeftOf="@+id/action_button" />
<ImageView android:id="@id/action_button" android:src="@drawable/row_action"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentRight="true" android:layout_marginTop="20dip" />
나는 다음 backgroun에 설정 d 위로 가기 & 맨 아래 행이 중간 행과 다르게 렌더링되도록 사용자 지정 목록 어댑터 getView() 메서드에서.
if(position == 0)
{
holder.contentLayout.setBackgroundResource(R.drawable.top_row);
} else if(position == posts.size() - 1)
{
holder.contentLayout.setBackgroundResource(R.drawable.bottom_row);
} else {
holder.contentLayout.setBackgroundResource(R.drawable.inner_row);
}
대답은 "정확히"하지만 당신은 단순히 사용하여 이 행 외부로을 표시 이미지를 만들 수 있어야 목록의 가장자리처럼 보이는 목록 항목의 배경 이미지는 실제로 위치에서 몇 픽셀 떨어져 있습니다. 그런 다음 오버플로하려는 요소를 오른쪽 정렬하고 그렇지 않은 요소에 오른쪽 패딩/여백을 추가 할 수 있습니다.
행의 높이가 어떻게 변할 수 있는지 확신 할 수 없습니다. – Ben
내가 분명히했는지는 알 수 없습니다. 이미지는 행의 오른쪽 상단에 정렬 된 행에 사용중인 뷰의 하위 항목이어야합니다. 테두리와 공백을 포함하지만 오른쪽에 패딩 영역이없는 목록 (즉, nine 패치)을 사용하는 경우 상자 외부에서 오버플로되는 것으로 보입니다 (즉, nine 패치의 내용 영역은 오른쪽 테두리). 그러나 여전히 목록 행의 적절한 하위 항목이므로 높이에 관계없이 오버플로 이미지는 각 행에 맞게 올바르게 배치됩니다. –
AbsoluteLayout을 사용하여이 작업을 수행 할 수있는 방법이있을 것이라고 생각했지만 사용하지 않는 것이 좋습니다.하지만 아마도 작동 할 수 있습니다. ??? – Ben
당신은 모든 조상보기 그룹에 다음 android:clipChildren="false"
및 바로 위 부모 뷰에 android:clipToPadding="false"
, android:clipChildren="false"
를 사용하여이를 구현 한 다음 이미지보기에 부정적인 마진을 넣을 수 있어야한다; 즉 android:layout_marginLeft="-10dp"
입니다.
이러한 작동 방식을 이해하는 데 다소 시간이 걸렸습니다. 특히 android:clipChildren="false"
. Google은 "자식이 경계 내부를 그리는 것이 제한되어 있는지 여부를 정의합니다."라고 말하면서 중요한 점은 하위의 '경계'가 부모보기 그룹의 경계가 아니라 정의 된 경계의 경계라는 점입니다 레이아웃 속성에 의해 조상 트리까지 모든 것을 필요로하는 이유입니다.
- 1. WPF 목록보기의 텍스트 상자, 콤보 상자
- 2. 로드 중 셀 외부에있는 IE8 테이블 이미지
- 3. 선택한 항목의 목록보기의 경고 대화 상자
- 4. 안드로이드 - 사용자 지정 목록보기의 빈 목록
- 5. 목록보기의 첫 번째 열에 이미지 추가 C#
- 6. 이미지 카운트를 실행중인 것으로 변환합니까?
- 7. 목록보기의 너비 조정
- 8. 목록보기의 행 수 제한
- 9. 안드로이드 : 이미지
- 10. Xcode의 "빌드 및 분석"이 이러한 제한을받는 것으로 생각되는 범위는 무엇입니까?
- 11. 안드로이드 대화 상자 재설정
- 12. 단일 선택 내 안드로이드 이미지
- 13. Android의 활동 외부에있는 요소 배치
- 14. div 외부에있는 테이블 내용
- 15. div 외부에있는 HTML 콘텐츠가 정상적으로 제거되었습니다.
- 16. 부풀린 목록보기의 문제
- 17. 목록보기의 Android 동적 아이콘
- 18. ASP.NET 이미지 목록 상자
- 19. 고급 상자 크기 이미지
- 20. Active Directory로 생각되는 웹 서비스 사용
- 21. 안드로이드 대화 상자 레이아웃 이해하기
- 22. 안드로이드 대화 상자 위치 설정
- 23. 안드로이드 이미지 배치
- 24. 안드로이드 MapView에 이미지 추가
- 25. 안드로이드, 이미지 및 dpi
- 26. 안드로이드 자바 임의의 이미지
- 27. 원 PNG 이미지 안드로이드
- 28. 안드로이드 업로드 이미지
- 29. 안드로이드 이미지 효과
- 30. 안드로이드, 캔버스, 그릴 이미지
안녕 벤, "행의"당신은 녹색 이미지를 의미합니까 ??? – Jorgesys
예 녹색 이미지 ... – Ben