2017-06-23 97 views
0

enter image description hereXML關鍵詞不

我做Android Studio中一個非常基本的測試應用程序。我爲按鈕按下的事件創建了一個xml文件,但由於某種原因,它沒有突出顯示任何關鍵字。我更新了android studio。我對如何解決這個問題感到不知所措,因爲這對我來說是一個新的過程。

當我嘗試爲bt_pressed XML定義這些屬性時,燈泡給我的消息是「在佈局文件中發現了意外的文本」。

回答

0

確保您的屬性在標籤中正確嵌套。就像這樣:

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="rectangle"> 
    <solid android:color="@color/some_color" /> 
</shape> 

(提示:看>人物在你提供的代碼段)

0

符合安裝不正確「>」 2.

0

我最近做下面一個項目的矩形和它工作得很好。將它嵌入第一個形狀標籤之間。

<shape xmlns:android="http://schemas.android.com/apk/res/android"> 
    <shape android:shape="rectangle"> 
     <corners android:radius="3dip" /> 
     <solid android:color="@color/colorTwo" /> 
    </shape> 
</shape> 

另外,不要窩任何事情,改變你的開口形狀的標籤,以這樣的:

<shape xmlns:android="http://schemas.android.com/apk/res/android" 
android:shape="rectangle">