2017-12-21 5 views
0

ButtonBorderColor 특성을 설정할 수 없습니다. 내가 뭘 잘못하고 있는지 모르겠지만 Visual Studio에서 속성이 선언되지 않았다고합니다. Android:BorderColor도 작동하지 않습니다.Xamarin.Android 단추 테두리가 선언되지 않았습니다.

The 'BorderColor' attribute is not declared 

내 코드 :

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/white"> 
    <TextView 
     android:id="@+id/header" 
     android:text="@string/header" 
     style="@style/header_text" /> 
    <Button 
     android:id="@+id/phones_button" 
     android:layout_below="@id/header" 
     android:layout_alignParentStart="true" 
     android:layout_height="100dp" 
     android:layout_width="150dp" 
     android:textColor="@color/gray" 
     android:background="@color/white" 
     BorderColor="@color/gray" 
     android:text="@string/phones" 
     style="@style/button_style" /> 
</RelativeLayout> 
+2

관련 게시물을 첨부 된 이미지가 아닌 텍스트로 편집하십시오. – avojak

+0

죄송합니다. 그냥 질문을 업데이 트 :) 감사합니다! –

답변

0

BorderColor 속성을 내 Button으로 설정할 수 없습니다.

당신은 @Konstantin Burov's answer을 참조하여 Button에 대한 배경으로 모양 드로어 블 (사각형)을 설정할 수 있습니다.

<Button 
    android:id="@+id/my_button" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello" 
    android:textColor="@color/grey" 
    android:layout_margin="30dp" 
    android:background="@drawable/Button_Border" 
    /> 

당김 Button_Border.xml을 사각형을 만들고 Resource/Drawable 폴더에 넣어 :

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="rectangle" > 
    <solid android:color="@android:color/white" /> 
    <stroke android:width="1dp" android:color="#FF4081"/> 
</shape> 

효과 :

enter image description here

업데이트 :

이 그것이 해결되지 않습니다 '대답, 그리고 아무 BorderColor 속성은 Android입니다. 참고 사항 :

대부분의 Android보기에는 Android 네임 스페이스의 속성이 있습니다. 이러한 속성을 참조 할 때 네임 스페이스 접두어를 포함해야합니다. 그렇지 않으면 속성이 aapt에 의해 사용자 정의 속성으로 해석됩니다.

이것이 작동하지 않는 이유입니다. 그게 바로이 프로젝트를 오류없이 기기에 배포 할 수있는 이유입니다.

+0

이것은 나를 위해 일합니다. 고마워,하지만 좀 더 해결 방법 같아. 단추의 테두리를 설정할 다른 방법이 없다고 상상할 수 없습니다. –

+0

@ ls-dev, 제 답변을 업데이트했습니다. 확인하십시오. –

+0

오, 감사합니다. 그걸 몰랐어. –

0
The 'BorderColor' attribute is not declared 

문제는 IntelliSense를 그 속성이 안드로이드 SDK에서 기존 및 해당 속성이 선언되지 않은 것을 보여하고 있지만 우리가 입력 속성을 선택하지 수 있습니다.

Visual Studio의 XML 스키마 폴더에있는 .xsd 파일이 누락 되었기 때문에 이러한 오류가 발생합니다.

는 아래에 주어진 이러한 파일을 링크를 다운로드,이 문제를 해결하려면, 당신은 다운로드 할 수 있습니다

과에 수동으로 파일을 이동 :

C:\Program Files (x86)\Microsoft Visual Studio 14.0\XML\Schemas 

또는

C:\Program Files (x86)\Microsoft Visual Studio 14.0\XML\Schemas\1033 
+0

흠.이 솔루션은 더 나은 솔루션처럼 보입니다. 그러나 저에게는 효과적이지 않습니다. 누락 된 .xsd 파일이 있습니까? –

관련 문제