내 응용 프로그램의 정보를 입력하기 위해 사용자 정의 헤더를 그리는 중입니다. 나는 xml에 2 개의 도형을 그린 다음 레이아웃에 배치했습니다. 그 레이아웃은 다음을 사용하여 내 메인 레이아웃에 배치됩니다. 그러나 포함 된 각 머리글 주위에 검은 색 테두리가 그려져 있습니다. 이것은 api 21 장치에만있는 것으로 보입니다. 무슨 일 이니?Drawable android 주위의 이상한 검은 색 테두리 XML
circle.xml
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/icon_background"
android:shape="oval">
<padding
android:left="2dp"
android:top="2dp"
android:right="2dp"
android:bottom="2dp" />
<solid
android:color="@color/color_primary"
android:angle="270">
</solid>
</shape>
line.xml
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke android:width="5dp"
android:color="@color/color_primary"/>
<size android:height="10dp" />
</shape>
헤더 레이아웃
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_height="5dp"
android:layout_width="match_parent"
android:layout_alignParentStart="true"
android:layout_marginTop="14dp"
android:src="@drawable/line">
</ImageView>
<ImageView
android:id="@+id/circle"
android:layout_height="32dp"
android:layout_width="32dp"
android:src="@drawable/circle"
android:layout_centerHorizontal="true">
</ImageView>
<ImageView
android:id="@+id/header_icon"
android:layout_height="32dp"
android:layout_width="32dp"
android:src="@drawable/ic_action_car"
android:layout_centerHorizontal="true">
</ImageView>
</RelativeLayout>
포함 된 레이아웃
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/header_horizontal_margin"
android:paddingRight="@dimen/header_horizontal_margin"
android:paddingTop="@dimen/header_vertical_margin"
android:paddingBottom="@dimen/header_vertical_margin">
<include
android:id="@+id/carSpecs"
layout="@layout/header"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</include>
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/header_vertical_margin"
android:paddingBottom="@dimen/header_vertical_margin"
android:layout_gravity="center_horizontal"
android:id="@+id/vehicleSpinner"
android:layout_below="@+id/carSpecs"/> ...
모든 기기에서 발생합니까? Android 에뮬레이터에서 테스트 해 보셨습니까? – alanv
나는 api21 장치에서 그것을 알아 차린다. 낮은 API는 괜찮아 보입니다. – kd8bny
샘플 XML이 제공된 5.0.1 에뮬레이터 또는 Nexus 기기에서이를 재현 할 수 없습니다. 그래도 drawable이 wrap_content 나 10dp로 바뀌는 ImageView의 높이를 바꿀 필요가있었습니다. – alanv