2016-06-15 2 views
0

붉은 색 테두리 (너비 1px)와 아래쪽에서 빨간색 사각형을 첨부하여 흰색 사각형 모양을 만들어야합니다. 이처럼 : 빨간색 테두리와 빨간색 사각형 입력 오류에 대해 사용자에게 통지하기 위해 나타납니다 동안Android : 배경색이 모양 가장자리로 변하지 않도록하십시오.

enter image description here

흰색 사각형 EditText 될 것입니다. 멋진 일은 없어.

나는 여러 가지 접근법을 이미 시도했지만, 같은 이유로 인해 아무 것도 보이지 않았습니다. 색상이 모양 가장자리로 바뀝니다. 바깥 쪽 픽셀이 바뀌는 것처럼 보입니다. 문제는이 확대 된 사진에서 볼 수있다 :

enter image description here

이 특정 스냅 샷의 계층 구조는 빨간색 배경 LinearLayout1pxpadding,하지만 난이 같은 효과 동안뿐만 아니라 다른 방법을 사용하려고 관찰 (프로그래밍 방식으로 EditText 주위에 경계선 그리기 포함).

이 효과는 Android의 표준처럼 보입니다. 제 질문은 어떻게 비활성화 할 수 있습니까?

답변

0

- 기술 된 행동이었다 일부 에뮬레이터 관련 유물. 실제 장치에서는 색상이 좋았습니다.

0

다음 예제를 확인하여 도움을 받으시기 바랍니다.

rect_shape.xml

<?xml version="1.0" encoding="utf-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
     android:shape="rectangle"> 

    <stroke 
     android:width="3dp" 
     android:color="#EF9A9A"/> 
    <solid android:color="@android:color/white"/> 

</shape> 

layout.xml

<LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/rectangle_shape" 
     android:orientation="vertical"> 

     <EditText 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@android:color/transparent" 
      android:lines="3" 
      android:padding="5dp"/> 

     <View 
      android:layout_width="match_parent" 
      android:layout_height="3dp" 
      android:background="#EF9A9A"/> 

     <TextView 
      android:layout_width="match_parent" 
      android:layout_height="36dp" 
      android:layout_marginBottom="3dp" 
      android:layout_marginLeft="3dp" 
      android:layout_marginRight="3dp" 
      android:background="#EF5350"/> 


    </LinearLayout> 

출력 :

누군가가이 질문에 실수를 한단다 그냥 경우

enter image description here

+0

이것은 정확히 내가 원하는 것과 반대입니다 - 구별 할 수있는 "테두리"가없는 견고한 모 놀리 식 색상을 원합니다. – Vasiliy

+0

안녕하세요, Vasiliy 정확하게 원하는 것을 설명해주세요. – Sach