2017-02-06 61 views
0

我開始學習Android的工作室。我得到一個相對佈局的XML文件錯誤,請看看,另外我有一些丟失/刪除的XML內容,導致error.Please看看,並幫助我。 目前activity_main.xml中的代碼如下:什麼是在XML文件中,指出錯誤解析XML錯誤:沒有很好地形成(標記無效)在Android Studio中

<?xml version="1.0" encoding="utf-8"?> 
android:fitsSystemWindows="true" 
tools:context="com.mindbuzz.big.calculator.MainActivity"> <android.support.design.widget.AppBarLayout 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:theme="@style/AppTheme.AppBarOverlay"> 
<android.support.v7.widget.Toolbar 
android:id="@+id/toolbar" 
android:layout_width="match_parent" 
android:layout_height="?attr/actionBarSize" 
android:background="#ed0d0d" 
app:popupTheme="@style/AppTheme.PopupOverlay" /> 
</android.support.design.widget.AppBarLayout> 
<android.support.design.widget.FloatingActionButton 
android:id="@+id/fab" 
android:layout_gravity="bottom|end"`enter code here` 
android:layout_margin="@dimen/fab_margin " 
app:srcCompat="@android:drawable/ic_dialog_email" 
android:layout_width="wrap_content" 
android:layout_height="match_parent" /> 
<include layout="@layout/content_main" 
android:layout_alignParentLeft="true" 
android:layout_alignParentStart="true" 
android:layout_alignBottom="@+id/appBarLayout" 
android:layout_below="@+id/appBarLayout" /> 
</ android:layout_width="wrap_content" 
android:layout_height="wrap_content"> </android.support.design.widget.CoordinatorLayout> 

赫斯是錯誤的預覽渲染: 呈現問題

注:

This project contains Java compilation errors, which can cause rendering failures for custom views. Fix compilation problems first. 

注:

One or more layouts are missing the layout_width or layout_height attributes. These are required in most layouts.<br/
<android.support.design.widget.AppBarLayout> does not set the required layout_width attribute: Set to wrap_content, Set to match_parent<br /> 
<android.support.design.widget.AppBarLayout> does not set the required layout_height attribute:     Set to wrap_content, Set to match_parent<br /> 
<android.support.v7.widget.Toolbar> does not set the required layout_width attribute: Set to wrap_content, Set to match_parent<br/
<android.support.v7.widget.Toolbar> does not set the required layout_height attribute: Set to wrap_content, Set to match_parent<br/
<android.support.design.widget.FloatingActionButton> does not set the required layout_width attribute: Set to wrap_content, Set to match_parent <br /> 
<android.support.design.widget.FloatingActionButton> does not set the required layout_height attribute: Set to wrap_content, Set to match_parent <br /> 
Or: Automatically add all missing attributes 

Gradle構建顯示以下錯誤:

Error:(3) Error parsing XML: not well-formed (invalid token) 
Error:(3) Error parsing XML: not well-formed (invalid token) 

Error:Execution failed for task ':app:processDebugResources'. 
> com.android.ide.common.process.ProcessException: Failed to execute aapt 

謝謝。

+0

爲什麼你有這樣的''? – codeMagic

+0

@codeMagic的嘖我是指具有描述它以包圍在當前佈局的所有內容使用它。 – BHASKAR

+0

@BHASKAR,抱歉,註釋不語法或易懂的英語。 –

回答

0

實際上,你可以很清楚地看到你發佈的代碼中的錯誤是通過注意在語法高亮無法理解它。有廢話開頭(android:fitsSystemWindows="true"),以及多廢話進一步下跌(</ android:layout_width="wrap_content"),均由StackOverflow上表示有益顯示爲灰色,而不是彩色的文本。

相關問題