为什么会出现这个“错误”?我没有任何重复的属性。解决办法是什么?
错误信息
activity_commerce.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".view.CommerceActivity">
<fragment
android:id="@+id/commerce_fragment"
android:name=".view.CommerceFragment"
class=".view.CommerceFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
tools:layout="@layout/fragment_commerce" />
</RelativeLayout>
fragment_commerce.xml
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".view.CommerceActivity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:fillViewport="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/ver_fragment_commerce_relative_layout">
<RelativeLayout
android:id="@+id/description_block_relative_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/ver_fragment_commerce_relative_layout">
<TextView
android:id="@+id/description_text_view_fragment_commerce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="@string/description_fragment_commerce"
android:textStyle="bold"
android:padding="4dp"/>
<android.support.v7.widget.SwitchCompat
android:id="@+id/description_switch_fragment_commerce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignBaseline="@id/description_text_view_fragment_commerce"
android:checked="false"
android:enabled="true"/>
<TextView
android:id="@+id/content_description_text_view_fragment_commerce"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_below="@id/description_text_view_fragment_commerce"
android:hint="..."
android:padding="8dp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/schedule_block_relative_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/description_block_relative_layout">
<TextView
android:id="@+id/schedule_text_view_fragment_commerce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/schedule_fragment_commerce"
android:textStyle="bold"
android:padding="4dp"/>
<ImageView
android:id="@+id/switch_schedule_image_button_fragment_commerce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_arrow_drop_down_circle_24dp"
android:tint="@color/colorGreyAndroid"
android:paddingRight="8dp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/>
<TextView
android:id="@+id/now_schedule_text_view_fragment_commerce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:hint="Hoy 9:00-13:00, 17:00-20:30"
android:visibility="visible"
android:layout_alignBaseline="@id/schedule_text_view_fragment_commerce"
android:layout_alignBottom="@id/schedule_text_view_fragment_commerce"
android:layout_toRightOf="@id/schedule_text_view_fragment_commerce"
android:layout_toEndOf="@id/schedule_text_view_fragment_commerce"/>
<TextView
android:id="@+id/content_schedule_text_view_fragment_commerce"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="invisible"
android:layout_below="@id/now_schedule_text_view_fragment_commerce"
android:hint="Lunes:\t9:00-13:00, 17:00-20:30\nMartes:\t9:00-13:00, 17:00-20:30\nMiércoles:\t9:00-13:00, 17:00-20:30\nJueves:\t9:00-13:00, 17:00-20:30\nViernes:\t9:00-13:00, 17:00-20:30\nSábado:\t9:00-13:00, 17:00-20:30\nDomingo:\t9:00-13:00, 17:00-20:30"
android:padding="8dp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/image_slider_block_relative_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/schedule_block_relative_layout">
<Button
android:id="@+id/foo_temporal_image_slider_fragment_commerce"
android:layout_width="match_parent"
android:layout_height="150dp"
android:hint="IMÁGENES EN SLIDER"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/general_info_block_relative_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/image_slider_block_relative_layout">
<TextView
android:id="@+id/address_text_view_fragment_commerce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/address_fragment_commerce"
android:textStyle="bold"
android:padding="4dp"/>
<TextView
android:id="@+id/content_address_text_view_fragment_commerce"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="foo direccion"
android:layout_alignBaseline="@id/address_text_view_fragment_commerce"
android:layout_alignBottom="@id/address_text_view_fragment_commerce"
android:layout_toRightOf="@id/address_text_view_fragment_commerce"
android:layout_toEndOf="@id/address_text_view_fragment_commerce"
android:gravity="center_horizontal|end"
android:paddingRight="16dp"/>
<TextView
android:id="@+id/phone_number_text_view_fragment_commerce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/phone_number_fragment_commerce"
android:layout_below="@+id/address_text_view_fragment_commerce"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold"
android:padding="4dp"/>
<TextView
android:id="@+id/content_phone_number_text_view_fragment_commerce"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="foo phone"
android:layout_alignBaseline="@id/phone_number_text_view_fragment_commerce"
android:layout_alignBottom="@id/phone_number_text_view_fragment_commerce"
android:layout_toRightOf="@id/phone_number_text_view_fragment_commerce"
android:layout_toEndOf="@id/phone_number_text_view_fragment_commerce"
android:gravity="center_horizontal|end"
android:paddingRight="16dp"/>
<TextView
android:id="@+id/email_text_view_fragment_commerce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/email_fragment_commerce"
android:layout_below="@+id/phone_number_text_view_fragment_commerce"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold"
android:padding="4dp"/>
<TextView
android:id="@+id/content_email_text_view_fragment_commerce"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="foo mail"
android:layout_alignBaseline="@id/email_text_view_fragment_commerce"
android:layout_alignBottom="@id/email_text_view_fragment_commerce"
android:layout_toRightOf="@id/email_text_view_fragment_commerce"
android:layout_toEndOf="@id/email_text_view_fragment_commerce"
android:gravity="center_horizontal|end"
android:paddingRight="16dp"/>
<TextView
android:id="@+id/web_text_view_fragment_commerce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/web_fragment_commerce"
android:layout_below="@id/email_text_view_fragment_commerce"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textStyle="bold"
android:padding="4dp"/>
<TextView
android:id="@+id/content_web_text_view_fragment_commerce"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="foo web"
android:layout_alignBaseline="@id/web_text_view_fragment_commerce"
android:layout_alignBottom="@id/web_text_view_fragment_commerce"
android:layout_toRightOf="@id/web_text_view_fragment_commerce"
android:layout_toEndOf="@id/web_text_view_fragment_commerce"
android:gravity="center_horizontal|end"
android:paddingRight="16dp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/social_networks__block_relative_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/general_info_block_relative_layout">
<TextView
android:id="@+id/social_networks_text_view_fragment_commerce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/social_networks_fragment_commerce"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="8dp"
android:textStyle="bold"
android:padding="4dp"/>
<ImageView
android:id="@+id/facebook_image_view_fragment_commerce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_facebook"
android:visibility="visible"
android:layout_centerVertical="true"
android:layout_toLeftOf="@id/twitter_image_view_fragment_commerce"
android:layout_toStartOf="@id/twitter_image_view_fragment_commerce"/>
<ImageView
android:id="@+id/twitter_image_view_fragment_commerce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_twitter"
android:visibility="visible"
android:layout_alignTop="@id/facebook_image_view_fragment_commerce"
android:layout_toLeftOf="@id/instagram_image_view_fragment_commerce"
android:layout_toStartOf="@id/instagram_image_view_fragment_commerce"/>
<ImageView
android:id="@+id/instagram_image_view_fragment_commerce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_instagram"
android:visibility="visible"
android:layout_alignTop="@id/facebook_image_view_fragment_commerce"
android:layout_toLeftOf="@id/google_plus_image_view_fragment_commerce"
android:layout_toStartOf="@id/google_plus_image_view_fragment_commerce"/>
<ImageView
android:id="@+id/google_plus_image_view_fragment_commerce"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/ic_google_plus"
android:visibility="visible"
android:layout_alignTop="@id/facebook_image_view_fragment_commerce"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/google_maps__block_relative_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="visible"
android:layout_below="@id/social_networks__block_relative_layout">
<Button
android:id="@+id/foo_temporal_google_maps_fragment_commerce"
android:layout_width="match_parent"
android:layout_height="150dp"
android:hint="GOOGLE MAPS DEL COMERCIO"/>
</RelativeLayout>
<!--<RelativeLayout-->
<!--android:id="@+id/extras__block_relative_layout"-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_below="@id/google_maps__block_relative_layout">-->
<!--</RelativeLayout>-->
</RelativeLayout>
关于您的问题,请记住
Android
在 aLayout
中,您只能包含 anamespace
,在这种情况下:“错误”在 fragment_commerce.xml 文件中