代码中的标签不匹配和APPT2错误

时间:2018-08-28 09:09:34

标签: android-linearlayout mismatch

我有这段代码,总是在代码不匹配的地方出现错误,我自己看不到错误,有人可以帮我吗?谢谢一百万。

我也收到此错误:错误:java.util.concurrent.ExecutionException:com.android.tools.aapt2.Aapt2Exception:AAPT2错误:检查日志以获取详细信息

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".DetailsSongs">

    <android.support.design.widget.AppBarLayout
        android:layout_widht="match_parent"
        android:layout_height="wrap_content">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="FFECB3"
            android:padding="16dp"
            android:text="@string/songdetailsdescription" />
    </android.support.design.widget.AppBarLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientaion="vertical"
        android:weightSum="1"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1">

            <Linearlayout
                android:layout_width="match_parent"
                android:layouth_height="wrap_content"
                android:layout_marginEnd="16dp"
                android:layout_marginStart="16dp"
                android:orientation="vertical">

                <LinearLayout
                    android:layout_width="match_parent"
                    android:layouth_height="match_content"
                    android:layout_marginBottom="16dp"
                    android:layout_marginTop="16dp"
                    android:orientation="horizontal">


                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:background="@drawable/image_placeholder_dark_large"
                        android:contentDescription="@string/songdetailscontentdescriptionalbumart"
                        android:scaleType="center" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginBottom="8dp"
                        android:orientation="vertical">

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginEnd="8dp"
                            android:layout_marginStart="8dp"
                            android:paddingTop="16dp"
                            android:text="@string/songnameplaceholder"
                            android:textSize="24sp"
                            android:textStyle="bold" />

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_marginEnd="8dp"
                            android:layout_marginStart="8dp"
                            android:paddingTop="4dp"
                            android:text="@string/songauthorplaceholder"
                            android:textSize="16sp"
                            android:textStyle="bold" />

                        <Button
                            style="?android:attr/buttonBarButtonStyle"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:drawableEnd="@drawable/media_controls_play_dark_small"
                            android:gravity="center"
                            android:paddingBottom="2dp"
                            android:paddingBtottom="2dp"
                            android:text="@string/songdetailsplaynow" />
  

在这里说这条评论下面有一个错误(LinearLayout)

                    </Linearlayout>


                </LinearLayout>


                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/songdetailssimilarsongs"
                    android:textSize="18sp" />

                <HorizontalScrollView
                    android:id="@+id/related_albums"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="16dp" >
                    <include layout="@layout/relatedsongslist" />
                </HorizontalScrollView>

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:paddingBottom="16dp"
                    android:text="@string/songdescriptionplaceholder" />

            </LinearLayout>
        </ScrollView>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom"
            android:layout_weight="1">

            <include layout="@layout/player" />
        </LinearLayout>
    </LinearLayout>
</android.support.design.widget.CoordinatorLayout>

1 个答案:

答案 0 :(得分:0)

几乎所有标签都不匹配并导致问题,我不知道您在尝试什么,但我认为最好的选择是再次尝试重新设计

但这是我能提供的帮助。重写了您的xml。

<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DetailsSongs">

<android.support.design.widget.AppBarLayout
    android:layout_widht="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="FFECB3"
        android:padding="16dp"
        android:text="@string/songdetailsdescription" />
</android.support.design.widget.AppBarLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientaion="vertical"
    android:weightSum="1"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1">

    <Linearlayout
        android:layout_width="match_parent"
        android:layouth_height="wrap_content"
        android:layout_marginEnd="16dp"
        android:layout_marginStart="16dp"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layouth_height="match_content"
            android:layout_marginBottom="16dp"
            android:layout_marginTop="16dp"
            android:orientation="horizontal">


        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:background="@drawable/image_placeholder_dark_large"
            android:contentDescription="@string/songdetailscontentdescriptionalbumart"
            android:scaleType="center" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="8dp"
            android:orientation="vertical">

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="8dp"
                android:layout_marginStart="8dp"
                android:paddingTop="16dp"
                android:text="@string/songnameplaceholder"
                android:textSize="24sp"
                android:textStyle="bold" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginEnd="8dp"
                android:layout_marginStart="8dp"
                android:paddingTop="4dp"
                android:text="@string/songauthorplaceholder"
                android:textSize="16sp"
                android:textStyle="bold" />

            <Button
                style="?android:attr/buttonBarButtonStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:drawableEnd="@drawable/media_controls_play_dark_small"
                android:gravity="center"
                android:paddingBottom="2dp"
                android:paddingBtottom="2dp"
                android:text="@string/songdetailsplaynow" />
        </LinearLayout>
    </Linearlayout>



        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/songdetailssimilarsongs"
            android:textSize="18sp" />

        <HorizontalScrollView
            android:id="@+id/related_albums"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="16dp" >
            <include layout="@layout/relatedsongslist" />
        </HorizontalScrollView>

            <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingBottom="16dp"
            android:text="@string/songdescriptionplaceholder" />
    </ScrollView>
</LinearLayout>

    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:layout_weight="1">

    <include layout="@layout/player" />
    </LinearLayout>
</android.support.design.widget.CoordinatorLayout>

尝试一下,希望对您有帮助